P1739 Expression Parentheses Matching
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 $255$, and there are fewer than $20$ left parentheses.
Input Format
One line: the expression.
Output Format
One line: `YES` or `NO`.
Explanation/Hint
The expression length is less than $255$, and there are fewer than $20$ left parentheses.
Translated by ChatGPT 5