21 lines
377 B
Python
21 lines
377 B
Python
|
#!/bin/python3
|
||
|
|
||
|
import sys
|
||
|
from pprint import pprint
|
||
|
|
||
|
input_f = sys.argv[1]
|
||
|
|
||
|
result = 0
|
||
|
|
||
|
with open(input_f) as file:
|
||
|
for line in file:
|
||
|
for idx,i in enumerate(line):
|
||
|
if i == '(':
|
||
|
result += 1
|
||
|
if i == ')':
|
||
|
result -= 1
|
||
|
if result == -1:
|
||
|
print(idx+1)
|
||
|
break
|
||
|
print(result)
|