#P1739. Balanced Parentheses Checker

    ID: 15024 Type: Default 1000ms 256MiB

Balanced Parentheses Checker

Balanced Parentheses Checker

Given an expression consisting of lowercase English letters, operators (+, -, *, /) and round brackets (( and )), ending with the special character @, check whether the round brackets are matched correctly. The length of the expression is less than $255$, and the number of left round brackets is less than $20$.

inputFormat

The input is a single line string representing the expression terminated by @. For example: a+(b-c)@

outputFormat

Output YES if the parentheses are balanced, otherwise output NO.

sample

a+(b-c)@
YES