- 原题链接

 - 测试样例
 
input
 5
 10101011011
 0000
 11111
 110
 1100
 output
 YES
 YES
 YES
 YES
 NO
- Note
 
In the first testcase you can choose a sequence a=[1,3,6,9]. Removing the underlined letters from “10101011011” will produce a string “0011111”, which is sorted.
 In the second and the third testcases the sequences are already sorted.
 In the fourth testcase you can choose a sequence a=[3]. s′= “11”, which is sorted.
 In the fifth testcase there is no way to choose a sequence a such that s′ is sorted.
- 解题思路
这道题其实就是一道理解题,我们知道,我们不能在连续的地方删除,所以倘若存在至少2个连续的1在至少2个连续的0左边,那么这个字符串怎么删都不能保证是非递减的。 所以我们只要判断是否存在这种情况即可。 - 代码
 
/**
* @filename:B.cbp
* @Author : pursuit
* @Blog:unique_pursuit
* @email: 2825841950@qq.com
* @Date : 2021-03-18-23.10.03
*/
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn=1e5+5;
const int mod=1e9+7;
//
int t;
string s;
void solve(){
    int len=s.size();
    int index0,index1;
    for(index1=0;index1<len-1;index1++){
        if(s[index1]=='1'&&s[index1+1]=='1'){
            break;
        }
    }
    for(index0=len-2;index0>=0;index0--){
        if(s[index0]=='0'&&s[index0+1]=='0'){
            break;
        }
    }
    if(index1<index0){
        cout<<"NO"<<endl;
    }
    else{
        cout<<"YES"<<endl;
    }
}
int main(){
    while(cin>>t){
        while(t--){
            cin>>s;
            solve();
        }
    }
    return 0;
}                
                










