Олимпиадный тренинг

Задача 38597. Correct bracket sequence


Задача

Темы: Стек
Consider a sequence consisting of round, square, and curly brackets. The program must determine if the given bracket sequence is correct.

The empty sequence is valid. If A – is correct, then the sequences (A), [A], {A} – correct. If A and B – correct sequences, then the sequence AB – correct.

Input
A single line contains a bracket sequence containing no more than 100,000 brackets.

Imprint
If this sequence is correct, then the program should output the string yes, otherwise the string no.
Examples
# Input Output
1 ()[] yes