In [ ]:
myinput = '/home/fmuinos/projects/adventofcode/2015/ferran/inputs/input1.txt'
In [11]:
with open(myinput, 'rt') as f:
line = next(f).rstrip()
floor = sum([(char == '(') - (char == ')') for char in line])
print(floor)
In [13]:
floor = 0
pos = 0
for char in line:
pos += 1
floor += (char == '(') - (char == ')')
if floor == -1:
break
print(pos)