You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
399 B

f = open("input.txt", "r")
lines = f.read().splitlines()
def score(char):
if char.lower() == char:
return ord(char) - 96
else:
return ord(char) - 38
summed = 0
for line in lines:
first = line[: len(line) // 2]
second = line[len(line) // 2 :]
dups = list(set(first).intersection(second))
for dup in dups:
summed = summed + score(dup)
print(summed)