result to store the final output.opened to 0 to keep track of the balance of parentheses.c in the input string s.
c is an opening parenthesis (:
opened counter.opened is greater than 1, append c to result.c is a closing parenthesis ):
opened counter.opened is greater than 0, append c to result.result string.