← 返回 amazon 的题目列表Matching Parentheses
类型:online_judge
amazon
Matching Parentheses
Given a string containing only the characters '(' and ')', determine if the input string is valid. The input string is valid if all parentheses are correctly matched.
Examples:
Input: "()"
Output: true
Input: "())"
Output: false
Constraints:
The input string consists only of lowercase letters and the characters '(' and ')'.
The maximum length of the input string is 1000.
Example
Input
6
()(()())