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