#include<iostream> using namespace std; int main(void) { int t,i,flag; cin>>t; while(t--) { i=0;j=0;flag=1; while(scanf("%c",&c)!=EOF) { if(c=='(') i++; else if(i>=0) --i; else {flag=0;break;} } if(flag&&i==0) cout<<"Yes"<<endl; else cout<<"No"<<endl; } } /* Main.cc: In function 'int main()': Main.cc:10:9: error: 'j' was not declared in this scope i=0;j=0;flag=1; ^ Main.cc:11:23: error: 'c' was not declared in this scope while(scanf("%c",&c)!=EOF) ^ */ |
Double click to view unformatted code.