



Given a string s consisting of parentheses (, ), {, }, [, and ], write a function to determine if the input string is valid. An input string is valid if:
Example 1:
Input: s = "()"
Output: True
Example 2:
Input: s = "("
Output: False
Example 3:
Input: s = "()[]{}"
Output: True
0 <= s.length <= 10^4s consists of parentheses only.s = "()"OutputTrueWhyThe string has matching opening and closing parentheses.s = "(]"OutputFalseWhyThe string has mismatched parentheses.0 <= s.length <= 10^4s consists of parentheses onlydef is_valid(s: str) -> bool: