In a Messenger-style text input, users may type strings containing letters and parentheses. Given a string s, remove the minimum number of parentheses so the resulting string is valid, and return the resulting string.
A string is valid if:
'(' has a corresponding closing parenthesis ')'.ss so that it becomes validIf multiple valid answers exist, return any one of them.
Example 1
s = "lee(t(c)o)de)""lee(t(c)o)de"')' is unmatched, so removing it yields a valid string.Example 2
s = "a)b(c)d""ab(c)d"')' after a has no matching '(', so it must be removed.Example 3
s = "))(("""1 <= len(s) <= 10^5s consists of lowercase English letters and the characters '(' and ')'