2024-12-02 09:58:35 -06:00

14 lines
334 B
Python

with open('../input.text', 'r') as file:
data: str = file.read()
floor = 0
for i, char in enumerate(data):
if char == '(':
floor += 1
elif char == ')':
floor -= 1
if floor == -1:
print(f'The position of the character that causes Santa to first enter the basement is {i + 1}')
exit(0)