#include<iostream>
#include<cstdio>
#include<string.h>
using namespace std;
void swap(string &s,int i,int j){
char t = s[i];
s[i] = s[j];
s[j] = t;
}
void reverse(string &s,int i,int j){
while(i <= j){
swap(s,i,j);
i++,j--;
}
}
bool isSubString(string s,string s1){
for(int i = 0;i < s.size() - s1.size() + 1;i++){
// cout << s << " " << s1 << endl;
// cout << i << " "<< s[i] << " " << s1[0] << endl;
// cout << "=============================" << endl;
if(s[i] != s1[0]) continue;
int k = 0;
while(k < s1.size()){
if(s[i + k] != s1[k]) return false;
k++;
}
return true;
}
}
int main(){
string a, b;
cin >> a >> b;
if(a.size() < b.size()){
string t = a;
a = b;
b = t;
}
for(int i = 0;i < a.size();i++){
string a1(a);
reverse(a1,0,i);
reverse(a1,i + 1,a.size() - 1);
reverse(a1,0,a.size() - 1);
// cout << a1 << " " << a << " " << b << endl;
if(isSubString(a1,b)){
cout << "true";
return 0;
}
}
cout << "false";
return 0;
}
![]