Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a=input()
- a=a.replace('()','L')
- op=0
- m=len(a.replace('L', ''))//2
- for c in a:
- if c == '(':
- op += 1
- elif c == ')':
- op -= 1
- else:
- m += op
- print(m)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement