0
点赞
收藏
分享

微信扫一扫

A. String Building

爱喝酒的幸福人 2022-04-23 阅读 53
c++
#include<iostream>
#include<string>
using namespace std;
int main(){
    int t=0;
    cin>>t;
    getchar();
    while(t--){
        string s;
        getline(cin,s);
        int i=s.size();

        if(i==1||s.find("aba")!=-1||s.find("bab")!=-1||s[0]!=s[1]||s[i-1]!=s[i-2]) cout<<"no\n";            
        else cout<<"yes\n";
    }
    return 0;
}
举报

相关推荐

0 条评论