Balanced Parentheses


You are given a string consisting only of the characters (, ), [, ], {, and }.

A string is considered balanced if:

  • Every opening bracket is closed by the same type of bracket.
  • Brackets are closed in the correct order.

Determine whether the given string is balanced.

Input

A single line containing the string ss.

Output

Print YES if ss is balanced, otherwise print NO.

Constraints

  • 1s21051 \le |s| \le 2 \cdot 10^5
  • ss contains only (, ), [, ], {, }

Example 1

Input 1
()[]{}
Output 1
YES

Example 2

Input 2
([{}])
Output 2
YES

Example 3

Input 3
([)]
Output 3
NO

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.