<PREV Problem:
NEXT>
Solved by 2552 users: ...
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Brackets

Some bracket structures are valid while others are not. Your task is to determine whether a given bracket structure is valid.

Input contains a word of length at most 4000 consisting of symbols ( and ) only.

Output should be the single word "YES" or "NO" (without quotes).

SAMPLE INPUT #1:
()

SAMPLE OUTPUT #1:
YES

SAMPLE INPUT #2:
)(

SAMPLE OUTPUT #2:
NO

SAMPLE INPUT #3:
()(())()

SAMPLE OUTPUT #3:
YES

Athor:

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 200ms

SW soft NIX
ID = 54.161.108.158