finished day 1 2015
This commit is contained in:
parent
6a7a4df57f
commit
22d09272e1
16
2015/1/part_2.py
Normal file
16
2015/1/part_2.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
with open('input.txt', 'r') as input:
|
||||
pos = 0
|
||||
char_pos = 0
|
||||
text = input.readline()
|
||||
for char in text :
|
||||
if char == ')':
|
||||
pos -= 1
|
||||
elif char == '(':
|
||||
pos += 1
|
||||
char_pos += 1
|
||||
if pos == -1:
|
||||
print (char_pos)
|
||||
break
|
||||
|
||||
input.close()
|
||||
|
Loading…
Reference in a new issue