mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 12:50:32 +01:00
19 lines
407 B
Python
19 lines
407 B
Python
from __future__ import print_function
|
|
import fileinput
|
|
|
|
floor = 0
|
|
seenBasement = False
|
|
|
|
for line in fileinput.input():
|
|
for idx, c in enumerate(line.strip()):
|
|
if c == '(':
|
|
floor += 1
|
|
else:
|
|
floor -= 1
|
|
|
|
if not seenBasement and floor == -1:
|
|
seenBasement = True
|
|
print("Basement reached at", idx + 1)
|
|
|
|
print("Finally arrived at", floor)
|