1868: D++ Again .

内存限制:256 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

Background

The language D++, that was perfected by the participants of our March competition, continues improving. Its founders try to make the syntax as clear as it is possible in order to make the programming simpler in the future.
Of course, some minimal set of rules is to stay without changes. Your program is to check the observance of rules, concerning the arrangement of brackets and comments.
大意:D++语言仍处于改进阶段。创建者想使到它的语法尽可能地清晰,以便程序更简明。

Problem

A text of a correct D++ program contains a symbol part, arithmetic expressions and comments. Comments may appear everywhere and may contain every symbol. A comment is always opened by a pair of symbols "(*" and is closed by a pair of symbols "*)". Each comment must be closed. An arithmetic expression in D++ is always opened by "(", is closed by ")" and may contain any of the following symbols: "=+-*/0123456789)(" and, surely, comments. No spaces in arithmetic expressions are allowed, though a carriage return may occur. You may run across embedded brackets in an arithmetic expression. In this case these brackets are to be balanced. It means that "((1)))" as well as "(23))((+)" are not correct arithmetic expressions. An arithmetic expression is correct if and only if brackets placed correctly. At last, all the rest of the program text (the result of rejection of all comments and arithmetic expressions from the initial text of the program) may contain every symbol excluding "(" and ")".
We would like to especially notice that the spaces are posiible anywhere in a text of a program except when apppeearing in arithmetic expressions.
一个正确的D++程序包含符号部分,算术表达式,和注释。注释可以出现在任何地方,包含任何字符。注释的开头用"(*"表示,结束用 "*)"表示。每一个注释必须有结束标志。一个算术表达式是用"(",")"括起,可以包含以下字符:"=+-*/0123456789)(" ,当然可以有注释在其中。 算术表达式中不允许有空格(???),可以有回车符。算术表达式中可以嵌套括号,但括号必须匹配。即诸如: "((1)))" , "(23))((+)" 等不是合法的。当且仅当括号匹配正确,表达式才是正确的。最后,其他字符文字可以是除"(" 和")"外的字符。
另外特别指出,空格在程序的任一地方出现是可能的,除了不能在算术表达式中出现外。

输入

Some text is written in the standard input. There are not more than 10 000 symbols in the text. There may be Latin letters, digits, brackets, symbols of arithmetic operations and the symbols "end of line" and "carriage return".
输入一些文本,长度不超过10000,可能是字母,括号,字符,算术运算符,以及 "end of line"符号 和"carriage return"回车符,

输出

Your program should write "YES" to the output if the introduced text is a correct D++ program, and "NO" otherwise.
假如文本符合D++规则,则输出YES,否则输出NO

样例输入 复制

Hello, here is a sample D++ program. It contains some arithmetical expressions like
(2+2=4), (2+-/*) and ((3+3)*3=20(*this is not true, but you don?t have to verify it :-) *)+8)
 (* the closing bracket in the previous comment is also in order, since this bracket
does not belong to any arithmetical expression*)

样例输出 复制

YES