#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main( void )
{
while ( 1 )
{
string arr; //원본
string brr; //괄호만
getline( cin , arr, '.' ) ; //'.'이 입력되는 순간까지만 입력
bool flag = true ; //true라면 yes, false라면 no
if ( arr.empty ( ) ) break ; //아무것도 없다면 종료
for ( int i = 0 ; i < arr.length ( ) ; i++ )
{
if ( arr[ i] == '(' || arr[ i] == '[' ) //열린 괄호는 전부 push
brr.push_back ( arr[ i] ) ;
else if ( arr[ i] == ']' )
{
if ( brr.empty ( ) || brr[ brr.length ( ) - 1 ] ! = '[' ) //비어있거나 열린 대괄호가 아니라면 비교 중지
{
flag = false ;
break ;
}
else brr.pop_back ( ) ;
}
else if ( arr[ i] == ')' )
{
if ( brr.empty ( ) || brr[ brr.length ( ) - 1 ] ! = '(' ) //비어있거나 열린 소괄호가 아니라면 비교 중지
{
flag = false ;
break ;
}
else brr.pop_back ( ) ;
}
}
if ( flag && brr.empty ( ) ) cout << "yes" << endl; //brr에 괄호가 없고 중간에 정지되지 않았다면 yes
else cout << "no" << endl;
cin .ignore ( ) ; //입력 버퍼 비워주기
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4odm9pZCkKewoJd2hpbGUgKDEpCgl7CgkJc3RyaW5nIGFycjsJLy/sm5Drs7gKCQlzdHJpbmcgYnJyOwkvL+q0hO2YuOunjAoJCWdldGxpbmUoY2luLCBhcnIsICcuJyk7CS8vJy4n7J20IOyeheugpeuQmOuKlCDsiJzqsITquYzsp4Drp4wg7J6F66ClCgkJYm9vbCBmbGFnID0gdHJ1ZTsJCS8vdHJ1ZeudvOuptCB5ZXMsIGZhbHNl652866m0IG5vCgkJaWYgKGFyci5lbXB0eSgpKSBicmVhazsJLy/slYTrrLTqsoPrj4Qg7JeG64uk66m0IOyiheujjAoKCQlmb3IgKGludCB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pbiAoaGVhdmVuKSBpcyBhIHNjb3JlIGxpc3QpLgpbIGZpcnN0IGluIF0gKCBmaXJzdCBvdXQgKS4KSGFsZiBNb29uIHRvbmlnaHQgKEF0IGxlYXN0IGl0IGlzIGJldHRlciB0aGFuIG5vIE1vb24gYXQgYWxsXS4KQSByb3BlIG1heSBmb3JtICkoIGEgdHJhaWwgaW4gYSBtYXplLgpIZWxwKCBJW20gYmVpbmcgaGVsZCBwcmlzb25lciBpbiBhIGZvcnR1bmUgY29va2llIGZhY3RvcnkpXS4KKFsgKChbKCBbIF0gKSAoICkgKCggKSldICkpIF0pLgogLgou
So when I die (the [first] I will see in (heaven) is a score list).
[ first in ] ( first out ).
Half Moon tonight (At least it is better than no Moon at all].
A rope may form )( a trail in a maze.
Help( I[m being held prisoner in a fortune cookie factory)].
([ (([( [ ] ) ( ) (( ))] )) ]).
.
.