Limits 1s, 512 MB

You will be given a sequence of opening and closing brackets of different types ((, ), [, ], {, and }). You will have to determine if the sequence is a valid one.

A sequence of brackets is considered valid if every opened bracket of a type has a closing bracket of an equivalent type appearing after it. And, there are no unpaired brackets in the sequence.

Input

The input will contain a string of opening and closing brackets. The string will be no longer than 25 characters.

Output

Print Yes\texttt{Yes} if the input string contains a valid sequence of parentheses. Otherwise, print No\texttt{No}.

Samples

InputOutput
[[(){]}]
No
InputOutput
(([]{}[{}]){})[]
Yes

Submit

Login to submit.

Contributors

Statistics

90% Solution Ratio
md_jakariyaEarliest, Sep '19
md_jakariyaFastest, 0.0s
JUNIORHMMC_CODLightest, 0 B
Nusab19Shortest, 90B
Toph uses cookies. By continuing you agree to our Cookie Policy.