#P1739. 表达式括号匹配
表达式括号匹配
Description
Assume an expression consists of lowercase English letters, operators (+, -, *, /), and left/right round parentheses, with @ as the terminator of the expression. Write a program to check whether the left and right parentheses in the expression are matched. If they match, output YES; otherwise, output NO. The expression length is less than , and there are fewer than left parentheses.
Input Format
One line: the expression.
Output Format
One line: YES or NO.
2*(x+y)/(1-x)@
YES
(25+x)*(a*(a+b+b)@
NO
Hint
The expression length is less than , and there are fewer than left parentheses.
Translated by ChatGPT 5
京公网安备 11011102002149号