• + 0 comments

    What's the issue?

    include

    using namespace std; void printstack(stack s){ while(!s.empty()){ cout< st; bool t=true; for (auto ch:s){ if ((ch=='(')||(ch=='[') || (ch=='{')){ st.push(ch); //printstack(st); }else{ if ((ch==')') && (st.top()=='(')){ st.pop(); }else if((ch==']') &&(st.top()=='[')){ st.pop(); }else if((ch=='}') && (st.top()=='{')){ st.pop(); }else{ return "NO"; } } }

    if (st.empty()){
        return "YES";
    }else{
        return "NO";
    }
    

    } int main(){ int t; cin>>t; while(t--){ string s; cin>>s; cout<