#include
#include
#include
#include
#include
using namespace std;
string isCircle(string, string);
void main() {
int n; //line
int m = 2; //column
cout << "请输入行数:";
cin >> n;
//初始化vector空间
vector res(n); //判断结果
vector> arr(n); //2维数组
for (int i = 0; i < n; i++) {
arr[i].resize(m);
}
cout << "请依次输入字符串:" << endl;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin>>arr[i][j];
}
res[i] = isCircle(arr[i][0], arr[i][1]); //判断旋转词
}
for (int i = 0; i < n; i++) {
cout << res[i] << endl;
}
}
string isCircle(string str1,string str2) {
string str = str1 + str1;
bool tag;
if (str1.size() != str2.size()) {
tag = false;
}
else if (str.find(str2) != str.npos) {
tag = true;
}
else {
tag = false;
}
if (tag == true)
return "yes";
else
return "no";
}