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.

35 lines
889 B

lines = open("input.txt", 'r').read().splitlines()
11 months ago
letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
sum = 0
11 months ago
sum2 = 0
11 months ago
11 months ago
for i in range(len(lines)):
l = lines[i]
11 months ago
found = False
for c in l[:int(len(l)/2)]:
for d in l[int(len(l)/2):]:
if c == d:
11 months ago
sum += letters.index(c)+1
found = True
break
if found:
break
found = False
if i % 3 == 0:
for c in l:
for d in lines[i+1]:
if c == d:
for e in lines[i+2]:
if d == e:
sum2 += letters.index(c)+1
found = True
break
if found:
break
if found:
break
print(sum)
print(sum2)