aboutsummaryrefslogtreecommitdiff
path: root/2025/02/a.py
blob: 9c6fd84ed32e396cdb01ff5bb7140919935b2e32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import fileinput

def invalid(n):
	return n[:len(n)//2] == n[len(n)//2:]

s = 0
with fileinput.input() as lines:
	for line in lines:
		for r in line.split(","):
			l = r.split("-");
			for n in range(int(l[0]), int(l[1])+1):
				if invalid(str(n)):
					print(n)
					s += n
print(s)
				

Generated with cgit - Back to sebastiano.tronto.net