字符串水题:
#include <iostream> #include <cstdio> #include <cstring> #include <string> using namespace std; int main() { string s; int cases; string wr="LLL"; scanf("%d",&cases); while(cases--) { int res=0; cin>>s; int len=s.length(); for(int i=0;i<len;i++) { if(s[i]==‘A‘) res++; } if(s.find(wr,0)!=string::npos) { cout<<"NO"<<endl; continue; } if(res>1) { cout<<"NO"<<endl; continue; } cout<<"YES"<<endl; } }
时间: 2024-10-13 21:34:48