26 lines
464 B
Python
Executable File
26 lines
464 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
VALS = {}
|
|
|
|
for i in range(ord('a'), ord('z')+1):
|
|
VALS[chr(i)] = i - ord('a') + 1
|
|
|
|
for i in range(ord('A'), ord('Z')+1):
|
|
VALS[chr(i)] = i - ord('A') + 27
|
|
|
|
score = 0
|
|
|
|
with open('input') as f:
|
|
for line in f:
|
|
line = line.rstrip()
|
|
half = len(line)//2
|
|
compA = line[0:half]
|
|
compB = line[half:len(line)]
|
|
common = set(compA) & set(compB)
|
|
|
|
score = score + VALS[common.pop()]
|
|
|
|
print(score)
|
|
|
|
|