http://acm.hdu.edu.cn/showproblem.php?pid=1854
随手练习
#include <bits/stdc++.h>
using namespace std;
int t;
string s;
int main(){
scanf("%d",&t);
while(t--){
int flag=;
int zero=;
int one=;
string s2;
cin>>s2;
int len=s2.length();
for(int i=;i<len;i++){
if(s2[i]==''){
zero++;
}else{
if(zero==){
flag=;
}
zero--;
}
}
if(flag) cout<<"No"<<endl;
else{
cout<<"Yes"<<endl;
}
}
return ;
}