summaryrefslogtreecommitdiffstats
path: root/1/2.py
blob: 3bd93d4bcbf33da2c212a6e419acba0671d0244e (plain)
1
2
3
4
5
6
def sumiter(i):
    count = 0
    for e in i:
        count += e
        yield count
print(next(i + 1 for i, s in enumerate(sumiter({'(': 1, ')': -1}[c] for c in open('input').read().rstrip('\n'))) if s == -1))