import java.util.Scanner;
import java.util.Arrays;

public class Main
{

	public static void main(String[] args)
	{	Scanner s = new Scanner(System.in);
                String l = s.next();
                String m = s.next();
                int[] a = new int[3];
                int[] b = new int[100];
                int i=0,j=0,t=0;
                float sum1=0;
                int r= l.length();
                int k= m.length();
                if(r==k){
                    for(i=0;i<r;i++){
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    }
                }
                
                if(t==1){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
               
                
	}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main
{

	public static void main(String[] args)
	{	Scanner s = new Scanner(System.in);
                String l = s.next();
                String m = s.next();
                int[] a = new int[3];
                int[] b = new int[100];
                int i=0,j=0,t=0;
                float sum1=0;
                int r= l.length();
                int k= m.length();
                if(r==k){
                    for(i=0;i<r;i++){
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    }
                }
                
                if(t==1){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
               
                
	}
} Main public static void main(String[] args)
	{	Scanner s = new Scanner(System.in);
                String l = s.next();
                String m = s.next();
                int[] a = new int[3];
                int[] b = new int[100];
                int i=0,j=0,t=0;
                float sum1=0;
                int r= l.length();
                int k= m.length();
                if(r==k){
                    for(i=0;i<r;i++){
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    }
                }
                
                if(t==1){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
               
                
	} main {	Scanner s = new Scanner(System.in);
                String l = s.next();
                String m = s.next();
                int[] a = new int[3];
                int[] b = new int[100];
                int i=0,j=0,t=0;
                float sum1=0;
                int r= l.length();
                int k= m.length();
                if(r==k){
                    for(i=0;i<r;i++){
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    }
                }
                
                if(t==1){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
               
                
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) String l = s.next(); l s.next() s.next s String m = s.next(); m s.next() s.next s int[] a = new int[3]; a new int[3] 3 int[] b = new int[100]; b new int[100] 100 int i=0 i 0 j=0 j 0 t=0; t 0 float sum1=0; sum1 0 int r= l.length(); r l.length() l.length l int k= m.length(); k m.length() m.length m if(r==k){
                    for(i=0;i<r;i++){
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    }
                } r==k r k {
                    for(i=0;i<r;i++){
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    }
                } for(i=0;i<r;i++){
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    } i=0; i=0 i 0 i<r i r i++ i++ i {
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    } {
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    } String gf = l.substring(i,i+1); gf l.substring(i,i+1) l.substring l i i+1 i 1 String d = l.substring(0,i); d l.substring(0,i) l.substring l 0 i String gg = l.substring(i+1); gg l.substring(i+1) l.substring l i+1 i 1 String c= gf + gg + d; c gf + gg + d gf + gg + d gf gg d if(c.equals(m)){
                         t=1;
                       } c.equals(m) c.equals c m {
                         t=1;
                       } t=1 t 1 if(t==1){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                } t==1 t 1 {
                    System.out.println("Yes");
                } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
                    System.out.println("No");
                } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main
{

	public static void main(String[] args)
	{	Scanner s = new Scanner(System.in);
                String l = s.next();
                String m = s.next();
                int[] a = new int[3];
                int[] b = new int[100];
                int i=0,j=0,t=0;
                float sum1=0;
                int r= l.length();
                int k= m.length();
                if(r==k){
                    for(i=0;i<r;i++){
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    }
                }
                
                if(t==1){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
               
                
	}
} public class Main
{

	public static void main(String[] args)
	{	Scanner s = new Scanner(System.in);
                String l = s.next();
                String m = s.next();
                int[] a = new int[3];
                int[] b = new int[100];
                int i=0,j=0,t=0;
                float sum1=0;
                int r= l.length();
                int k= m.length();
                if(r==k){
                    for(i=0;i<r;i++){
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    }
                }
                
                if(t==1){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
               
                
	}
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main
{

	public static void main(String[] args)
	{	Scanner s = new Scanner(System.in);
                String l = s.next();
                String m = s.next();
                int[] a = new int[3];
                int[] b = new int[100];
                int i=0,j=0,t=0;
                float sum1=0;
                int r= l.length();
                int k= m.length();
                if(r==k){
                    for(i=0;i<r;i++){
                       String gf = l.substring(i,i+1);
                       String d = l.substring(0,i);
                       String gg = l.substring(i+1);
                       String c= gf + gg + d;
                       if(c.equals(m)){
                         t=1;
                       }
                      // System.out.println(c);
                    }
                }
                
                if(t==1){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
               
                
	}
}