Files
2024-11-11 09:05:01 +01:00

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)