blob: ae7d54626eca1452b7318a76e5fb0158e9ee3ef6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/env lua
local c = 0
for line in io.lines() do
local s1, e1, s2, e2 = line:match("(%d+)-(%d+),(%d+)-(%d+)")
s1, e1, s2, e2 = tonumber(s1), tonumber(e1), tonumber(s2), tonumber(e2)
if
(s2 >= s1 and s2 <= e1) or
(e2 >= s1 and e2 <= e1) or
(s1 >= s2 and e1 <= e2) or
(s2 >= s1 and e2 <= e1)
then
c = c + 1
end
end
print(c)
|