# Reverse Substrings between Each Pair of Parentheses
https://leetcode.com/problems/reverse-substrings-between-each-pair-of-parentheses/
## Solution 1: Brute Force
```python
stack = []
result = []
i = 0
for c in s:
match c:
case '(':
stack.append(i)
case ')':
start = stack.pop()
result[start:] = result[start:][::-1]
case _:
result.append(c)
i += 1
return ''.join(result)
```