Valid BracketsEasy

Valid Brackets

EasyPractice library · +10 XPstackstrings

A string made only of the characters ( ) [ ] { } is valid when every opening bracket is closed by a bracket of the same type, and brackets are closed in the right order.

Print YES if the string is valid and NO otherwise.

Input

One line: the string s.

Output

YES or NO.

Constraints

  • 1 <= |s| <= 200000
  • s only contains ()[]{}
Time limit 1 s (native code; slower languages get more)Memory 256 MB12 hidden tests

Example 1

Input
()[]{}
Output
YES

Every bracket is closed in order.

Example 2

Input
([)]
Output
NO

The square bracket is closed while a round one is still open.

Hints