blob: 713e2820acc6620ba9ff18a4e3d9c2a78e65917a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/usr/bin/python3
def cut(s: str) -> (str, str):
n = len(s) // 2
return s[:n], s[n:]
def main() -> None:
with open("input", "r") as f:
data = f.readlines()
acc = 0
for line in data:
car, cdr = cut(line)
for c in car:
if cdr.find(c) != -1:
if "a" <= c <= "z":
acc += ord(c) - ord("a") + 1
else:
acc += ord(c) - ord("A") + 27
break
print(acc)
if __name__ == "__main__":
main()
|