#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define ps push
#define pf push_front
#define mp make_pair
#define And &&
#define Or ||
#define ppb pop_back
#define ppf pop_front
#define inf INT_MAX
#define sz(name) name.size()
#define len(name) name.length()
#define ig cin.ignore()
#define Sort(name) sort(name.begin(),name.end())
#define For(name,start,finish) for(int name=start;name<finish;name++)
#define fast_in_out ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
//int row[]={-1,0,1,0};
//int col[]={0,1,0,-1};
 
const ll N=1e4+10;
const ll M=1e9+7;
 
ll Max(ll a,ll b){if(a>b)return a;return b;}
ll Min(ll a,ll b){if(a>b)return b;return a;}
ll big_mul(ll a,ll b,ll m){ll x=0,y=a%m;while(b>0){if(b&1)x=(x+y)%m;y=(2*y)%m;b>>=1;}return x%m;}
ll big_mod(ll a,ll b,ll m){ll x=1,y=a%m;while(b>0){if(b&1)x=(x*y)%m;y=(y*y)%m;b>>=1;}return x%m;}
ll Big_mod(ll a,ll b,ll m){ll x=1,y=a%m;while(b>0){if(b&1)x=big_mul(x,y,m);y=big_mul(y,y,m);b>>=1;}return x%m;}
ll mod_inverse(ll a,ll m){return big_mod(a,m-2,m);}  //a^-1 mod m = a^(m-2) mod m

int fnct(int pos1,int pos2,string s1,string s2,int k)
{
    
    for(int i=pos1;i<=pos2;i++,k++)
    {
        if(s1[i]!=s2[k])
        return false;
    }
    
    return true;
}
 
int main()
{
    fast_in_out;
    
    string s1,s2;
    cin>>s1>>s2;
    
    For(i,0,sz(s1))
    {
        if(fnct(i,sz(s1)-1,s1,s2,0)==true And fnct(0,i-1,s1,s2,sz(s1)-i))
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    
    cout<<"No"<<endl;
    
    return 0;
}
 