19 lines
446 B
Python
19 lines
446 B
Python
#/usr/bin/env python
|
|
|
|
import re
|
|
|
|
RE_MATCH = re.compile(r"^(\d+)\-(\d+),(\d+)\-(\d+)$")
|
|
|
|
total = 0
|
|
with open("input.txt", "r") as f:
|
|
for line in f:
|
|
line = line.strip()
|
|
m = RE_MATCH.match(line)
|
|
|
|
l1 = set(list(range(int(m.group(1)),int(m.group(2))+1)))
|
|
l2 = set(list(range(int(m.group(3)),int(m.group(4))+1)))
|
|
l = l2.intersection(l1)
|
|
|
|
if len(l):
|
|
total += 1
|
|
print(total) |