Given a string s containing only lowercase English letters and parentheses, reverse the strings in each pair of matching parentheses from the innermost to the outermost, and return the final result.
Note that your result should not contain any parentheses.
Example 1:
Input: s = "(abcd)"
Output: "dcba"
Example 2:
Input: s = "(u(love)i)"
Output: "iloveu"
Explanation: First, reverse the substring “love”, then reverse the entire string.
This problem asks you to reverse every parenthesized substring from the innermost pair outward, then remove all parentheses from the final output. A stack-based or recursive approach works well by pairing brackets and processing each nested segment in order. The main challenge is handling nested structure correctly while producing only the final letters in the right order.