17 lines
492 B
Python
17 lines
492 B
Python
with open("input.txt", "r") as f:
|
|
score = 0
|
|
for line in f.readlines():
|
|
line = line.strip()
|
|
(winners, cards) = line.split(" | ")
|
|
winners = list(winners.split(": ")[1].split(" "))
|
|
cards = cards.split(" ")
|
|
print(winners)
|
|
print(cards)
|
|
count = 0
|
|
for card in cards:
|
|
if card:
|
|
if card in winners:
|
|
count += 1
|
|
if count > 0:
|
|
score += 2 ** (count - 1)
|
|
print(score) |