33 lines
681 B
Python
33 lines
681 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
data = []
|
|
|
|
# parse input
|
|
input_file = open("input", "r")
|
|
for line in input_file:
|
|
line = line.strip()
|
|
part1 = line[:len(line)//2]
|
|
part2 = line[len(line)//2:]
|
|
# print(part1, part2)
|
|
for i in range(len(part1)):
|
|
if part1[i] in part2:
|
|
# print(part1[i])
|
|
data.append(part1[i])
|
|
break
|
|
input_file.close()
|
|
|
|
print(data)
|
|
solution = 0
|
|
for b in data:
|
|
if 96 < ord(b) < 123:
|
|
print(ord(b)-96)
|
|
solution += ord(b)-96
|
|
elif 64 < ord(b) < 91:
|
|
print(ord(b)-64+26)
|
|
solution += ord(b)-64+26
|
|
else:
|
|
print("Fehler")
|
|
|
|
print("Lösung 1:", solution)
|