|Online MIPT programming contest||РУССКИЙ|
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
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
© acm.mipt DevGroup
The page was generated in 230ms