首页 > 代码库 > 出勤记录I HihoCoder - 1481

出勤记录I HihoCoder - 1481

字符串水题:

#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;
   }
}

  

出勤记录I HihoCoder - 1481