Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def reverseParentheses(s):
- check = True
- while check:
- rb = s[s.rfind("(", 0, s.find(")")) + 1:s.find(")")]
- ra = rb[::-1]
- s = s.replace ("(" +rb+ ")", ra)
- if s.find(")") == -1:
- check = False
- return s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement