I love 114514

I love 114514

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1410    Accepted Submission(s): 1098


 

Problem Description
Mr.I loves 114514 very much.

Now Mr.I has a string, if "114514" is a substring of this string, then Xiaoi will also love this string.

Please judge whether Xiaoi loves this string, if Xiaoi loves this string, output "AAAAAA", otherwise output "Abuchulaile".

 
 

Input
The first line contains an integer T(T≤10) . Then T test cases follow.

Each test case contains a string s(1≤|S|≤105).
 

Output
For each test case, output a single line contain the answer for the test case.
 

Sample Input
2
114514
1919810 
Sample Output
AAAAAA
Abuchulaile
题解
就是看那个字符串能不能找到  114514 作为子串
#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        int p=0;
        string a="114514";
        for(int j=0,i=0;i<s.length();)
        {
            if(a[j]==s[i])
            {
                i++;
                j++;
            }
            else
            {
                i++;
            }
            if(j==a.length())
            {
                p=1;
                break;
            }
        }
        if(p==1)
        cout<<"AAAAAA"<<endl;
        else
        cout<<"Abuchulaile"<<endl;
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值