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

27 lines
653 B
Python

#!/usr/bin/env python3
INPUT_FILE = 'input'
def grouper(n, iterable, fill=None):
args = [iter(iterable)] * n
#return izip_longest(fillvalue=fillvalue, *args)
return zip(*args)
def main():
content = map(str.strip, open(INPUT_FILE, 'r').readlines())
score = 0
gen = grouper(3, content)
for r1,r2,r3 in gen:
for char in r1:
if char in r2 and char in r3:
print(char)
if char.islower():
score += ord(char) - 96
else:
score += ord(char) - 38
break
print(score)
if __name__ == '__main__':
main()