ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1027. D++ Again

Time limit: 0.5 second
Memory limit: 64 MB

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.

Problem

A text of a correct D++ program contains a symbol part, arithmetic expressions and comments. Comments may appear everywhere and may contain any symbols. 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 only symbols "=+-*/0123456789)(" and "end of line" symbols. An arithmetic expression can't start with a pair of symbols "(*". 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 possible anywhere in a text of a program except when appearing in arithmetic expressions.

Input

Some text is written in the standard input. There are not more than 10000 symbols in the text. There may be Latin letters, digits, brackets, symbols of arithmetic operations, spaces and "end of line" symbols.

Output

Your program should write "YES" to the output if the introduced text is a correct D++ program, and "NO" otherwise.

Sample

input
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*)
output
YES
Problem Author: Leonid Volkov, Alexey Lysenko
Problem Source: Ural State University Internal Contest October'2000 Junior Session