#include <iostream>
using namespace std;
int main()
{
string a, b;
cin >> a >> b;
if (b.size() > a.size())
swap(a, b);
a = a + a;
if (a.find(b) >= a.size())
cout << "false";
else
cout << "true";
return 0;
}