about summary refs log tree commit diff
path: root/aoc/2022/04/part-one.jl
blob: 3f409ea5859798f1284e087f19dd0b802fb353aa (plain) (blame)
1
2
3
4
5
6
7
8
#!/usr/bin/env julia
function containing(line)
  (a, b), (c, d) = map(r -> map(i -> parse(Int16, i),
                                split(r, '-')),
                       split(line, ','))
  (c - a) * (d - b) <= 0
end
println(sum(map(containing, readlines(stdin))))