#include <bits/stdc++.h> #define MAX 1000000 using namespace std; char st[100]; bool match(char a, char b) { if( (a == '(' && b == ')') || (a == '{' && b == '}') || (a == '[' && b == ']') ) return true; else return false; } int main() { while(gets(st)) { int t = 1; stack<char>Q; for(int i = 0; st[i]; i++) { if(st[i] == '(' || st[i] == '{' || st[i] == '[') { Q.push(st[i]); } else if(st[i] == ')' || st[i] == '}' || st[i] == ']') { if(Q.empty() || !match(Q.top(),st[i])) { t = 0; break; } else if(match(Q.top(),st[i])) Q.pop(); } } if(Q.empty() && t) { cout << "yes" << endl; } else { cout << "no" << endl; } } }