#include<bits/stdc++.h> using namespace std; string s; stack<char>st; int main(){ cin>>s; for(int i=0;i<s.size();i++){ if(s[i]==')'){ if(st.empty()||st.top()!='('){ cout<<"no"; return 0; } st.pop(); } else if(s[i]==']'){ if(st.empty()||st.top()!='['){ cout<<"no"; return 0; } st.pop(); } else st.push(s[i]); } if(st.empty()){ cout<<"yes"; return 0; } cout<<"no"; } /************************************************************** Problem: 1486 User: chenshuo Language: C++ Result: Accepted Time:26 ms Memory:2080 kb ****************************************************************/