#P1739. 表达式括号匹配

    ID: 2515 远端评测题 1000ms 128MiB 尝试: 3 已通过: 3 显示难度入门 上传者: 标签>模拟字符串线性数据结构

表达式括号匹配

Problem 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 255255, and there are fewer than 2020 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 255255, and there are fewer than 2020 left parentheses.

Translated by ChatGPT 5