advent-of-code/2015/01/part02.py

19 lines
243 B
Python
Raw Normal View History

2021-12-01 11:07:21 +01:00
with open("input") as f:
puzzle_input = f.read()
floor = 0
position = 1
for char in puzzle_input:
if char == "(":
floor += 1
else:
floor -= 1
if floor == -1:
break
position += 1
print(position)