Codeforces Round #834 (Div. 3) A. Yes-Yes?
Note that it is enough to consider the string f u l l full full= Y e s Y e s . . . Y e s YesYes...Yes YesYes...Yes, where Yes is written 18 18 18 times, since 18 ⋅ 3 = 54 18⋅3=54 18⋅3=54, and our substring s s s has size ∣ s ∣ ≤ 50 |s|≤50 ∣s∣≤50.
Then we just use the built-in function find to f i n d find find out if our string s s s is a substring of the string f u l l full full.
#include<bits/stdc++.h>
using namespace std;
int main()
{
string str;
for(int i=0;i<50;i++)
str+="Yes";
int T;cin>>T;
while(T--)
{
string s;cin>>s;
if(str.find(s)!=-1) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}