#t435. 表达式括号匹配(stack)
表达式括号匹配(stack)
Expression Parenthesis Matching (Stack)
Problem Background
Special for beginners, ^_^
Problem Description
Suppose an expression consists of English letters (lowercase), operators (+, -, *, /), and left/right parentheses, with @ as the terminator of the expression. Please write a program to check whether the left and right parentheses in the expression match. If they match, return YES; otherwise return NO. The expression length is less than , and there are fewer than left parentheses.
Input Format
One line of data: the expression.
Output Format
One line: YES or NO. These words must be printed exactly as shown (do not translate).
Sample Input 1
2*(x+y)/(1-x)@
Sample Output 1
YES
Sample Input 2
(25+x)*(a*(a+b+b)@
Sample Output 2
NO
Constraints
Time limit 1s, memory limit 1024KiB for each test case.