advent/2015/1/sol.py

20 lines
278 B
Python
Raw Normal View History

2022-11-06 13:55:53 -06:00
#!/usr/bin/python3
file = [i.rstrip() for i in open("input").readlines()]
j = 0
count = 0
for i in file[0]:
if i == "(":
j += 1
elif i == ")":
j -= 1
count += 1
if j == -1:
print("fin: count = " + str(count))
exit()
print(j)