aoc/2015/01/part1.py

13 lines
250 B
Python
Raw Normal View History

2019-01-02 01:12:02 +00:00
import os
path = os.path.dirname(os.path.abspath(__file__))
with open(path+'/input.txt', 'r') as input:
2018-11-29 16:48:25 +00:00
counter = 0
text = input.readline()
for char in text :
if char == ')':
counter -= 1
elif char == '(':
counter += 1
print (counter)