给定两个字符串s1和s2,如果能通过s1循环移位,使s2包含在s1中,那么我们就说s2 是s1的亲和串。S1+S1后进行查找即可
#include<iostream>
#include<sstream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string s1,s2;
while(cin>>s1)
{
cin>>s2;
s1=s1+s1;
int ans=s1.find(s2);
if(ans!=-1) cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
return 0;
}