You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
388 B
14 lines
388 B
lines = open("input.txt", "r").read().splitlines()
|
|
overlap = 0
|
|
|
|
for line in lines:
|
|
lota, lotb = line.split(",")
|
|
lota = [int(i) for i in lota.split("-")]
|
|
lotb = [int(i) for i in lotb.split("-")]
|
|
intersect = set(range(lota[0], lota[1] + 1)).intersection(
|
|
set(range(lotb[0], lotb[1] + 1))
|
|
)
|
|
if len(intersect) > 0:
|
|
overlap = overlap + 1
|
|
print(overlap)
|