one liner

This commit is contained in:
Skye 2022-12-13 19:28:56 +09:00
parent 89fd3bed34
commit ec91ebd5b0
Signed by: me
GPG key ID: 0104BC05F41B77B8

8
3.py
View file

@ -1,8 +1,2 @@
with open("input3.txt") as f: with open("input3.txt") as f:
a = dict(zip(map(chr,(list(range(97,123))+list(range(65,91)))),range(1,53))) print(sum([(dict(zip(map(chr,(list(range(97,123))+list(range(65,91)))),range(1,53))))[((list(map(set,((line.strip())[:len((line.strip()))//2],(line.strip())[len((line.strip()))//2:])))[0])&(list(map(set,((line.strip())[:len((line.strip()))//2],(line.strip())[len((line.strip()))//2:])))[1])).pop()] for line in f.readlines()]))
s = 0
for line in f.readlines():
line = line.strip()
d, f = map(set,(line[:len(line)//2],line[len(line)//2:]))
s += a[(d&f).pop()]
print(s)