字符串移位包含问题原题链接
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a,b;
cin>>a>>b;
int lena=a.size();
int lenb=b.size();
if(lena<lenb)
{
swap(a,b);
swap(lena,lenb);
}
string a1; //记录字串
for(int i=0;i<lena;i++)
{
a=a.substr(1,lena-1)+a[0];
for(int j=0;j<lena&&(j+lenb)<lena;j++)
{
a1=a.substr(j,j+lenb);
if(a1==b)
{
cout<<"true";
return 0;
}
}
}
cout<<"false";
return 0;
}