20 lines
470 B
Python
20 lines
470 B
Python
|
f = open("file");
|
||
|
s = f.read();
|
||
|
f.close();
|
||
|
menfou = 0;
|
||
|
for pair in s.splitlines():
|
||
|
elfs = pair.split(",");
|
||
|
values = elfs[0].split("-")
|
||
|
start1 = int(values[0]);
|
||
|
end1 = int(values[1]);
|
||
|
values = elfs[1].split("-")
|
||
|
start2 = int(values[0]);
|
||
|
end2 = int(values[1]);
|
||
|
verif = 0;
|
||
|
for i in range(start1, end1 + 1):
|
||
|
for y in range(start2, end2 + 1):
|
||
|
if (y == i):
|
||
|
verif = 1;
|
||
|
menfou += verif;
|
||
|
print(menfou);
|