Reverse Substrings Between Each Pair Of Parentheses
medium
1: You are given a string s that consists of lower case English letters and brackets. 2: Reverse the strings in each pair of matching parentheses, starting from the innermost one. 3: Your result should not contain any brackets. Example (abcd) -> dcba (u(love)i) -> iloveu (gni(pc(do))ep) -> pepcoding
Constraints
1: 0 <= s.length <= 2000 2: s only contains lower case English characters and parentheses 3: It's guaranteed that all parentheses are balanced.
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
(gni(pc(do))ep)
Sample Output
pepcoding
Question Video