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".
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).
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;
}
}