def exercise3():
path = "parentheses.txt"
with open(path) as file:
parentheses = file.read().split()
for par in parentheses:
max_opening_length = 0
max_closing_length = 0
current_opening_length = 0
current_closing_length = 0
for char in par:
if char in ["[", "(", "{"]:
current_closing_length = 0
current_opening_length += 1
max_opening_length = max(max_opening_length, current_opening_length)
else:
current_opening_length = 0
current_closing_length += 1
max_closing_length = max(max_closing_length, current_closing_length)
print(max_opening_length, max_closing_length)