11 lines
472 B
Python
11 lines
472 B
Python
count = 0
|
|
with open("input.txt", "r") as f:
|
|
for line in f.readlines():
|
|
line = line.strip("\n")
|
|
# Some python magic to split out the strings and convert them to integers
|
|
pair = [x.split("-") for x in line.split(",")]
|
|
pair = [[int(y) for y in x] for x in pair]
|
|
if ((pair[0][0] <= pair[1][0] and pair[0][1] >= pair[1][1]) or
|
|
(pair[1][0] <= pair[0][0] and pair[1][1] >= pair[0][1])):
|
|
count += 1
|
|
print(count) |