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

Multiple Brackets

Time limit: 5 seconds.

Some bracket structures are valid while others are not.
In the valid bracket structure types of opening and closing braces should match.
Your task is to determine whether a given bracket structure is valid.

Input contains a word of length at most 100000 consisting of symbols ()[]{}<> only.

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

SAMPLE INPUT #1:
{)

SAMPLE OUTPUT #1:
NO

SAMPLE INPUT #2:
[({<>})]

SAMPLE OUTPUT #2:
YES

SAMPLE INPUT #3:
><

SAMPLE OUTPUT #3:
NO

Author:
Malykh Anton

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


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

SW soft NIX
ID = 23.20.13.165