简单粗暴,巧妙利用string的相关函数
#include<cstdio>
#include<iostream>
#include<regex>
using namespace std;
int main(){
string s1,s2,s3;
cin >>s1 >>s2;
if (s1.size()<s2.size()) {
s3=s2;
s2=s1;
s1=s3;
}
s1=s1+s1;
if (s1.find(s2)!=s1.npos) {
cout << "true" << endl;
}
else{
cout << "false" << endl;
}
return 0;
}