Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- count = 0
- count_max = 0
- first_index_max = 0
- last_index_max = 0
- with open('input.txt') as f:
- text = f.read()
- l = [x for x in text]
- for i in range(len(text)):
- if text[i] == '(':
- count += 1
- if text[i] == ')':
- if count > 0:
- count -= 1
- if count_max < count:
- count_max = count
- first_index_max = i
- if count_max - 1 == count:
- last_index_max = i
- print(*text)
- print("Максимальное колчество открытых скобок: ", count_max)
- print(text[first_index_max+1:last_index_max])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement