24 lines
613 B
Python
24 lines
613 B
Python
from string import ascii_letters
|
|
|
|
with open("day3\input.txt") as f:
|
|
data = f.readlines()
|
|
|
|
def findCommon(leftside:str,rightside:str):
|
|
for char in leftside:
|
|
if char in rightside:
|
|
return ord(char)
|
|
|
|
prio_sum = 0
|
|
while data:
|
|
test_strings = [data.pop(0) for idx in range(3)]
|
|
print(test_strings)
|
|
for prio,char in enumerate(ascii_letters):
|
|
if char in test_strings[0]:
|
|
if char in test_strings[1]:
|
|
if char in test_strings[2]:
|
|
prio_sum += prio+1
|
|
print(char, prio)
|
|
break
|
|
print(prio_sum)
|
|
|