You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
424 B
Python
19 lines
424 B
Python
fi = open("in.txt", "r")
|
|
lst = fi.read().split("\n")
|
|
|
|
good1 = 0
|
|
good2 = 0
|
|
|
|
for el in lst[:-1:]:
|
|
sets = el.split(",")
|
|
set1 = set(range(int(sets[0].split('-')[0]), int(sets[0].split('-')[-1])+1))
|
|
set2 = set(range(int(sets[1].split('-')[0]), int(sets[1].split('-')[-1])+1))
|
|
if set2.issubset(set1) or set1.issubset(set2):
|
|
good1 += 1
|
|
if len([el for el in set1 if el in set2]) > 0:
|
|
good2 += 1
|
|
|
|
print(good1)
|
|
print(good2)
|
|
|