11 lines
201 B
Python
11 lines
201 B
Python
import sys
|
|
|
|
line = sys.stdin.read().strip()
|
|
|
|
floor = 0
|
|
floors = [(floor := floor + (1 if c == "(" else -1)) for c in line]
|
|
|
|
|
|
print(f"answer 1 is {floors[-1]}")
|
|
print(f"answer 2 is {floors.index(-1)}")
|