Problem:
Score : 200 points

Problem Statement

You are given string S and T consisting of lowercase English letters.

Determine if S equals T after rotation.

That is, determine if S equals T after the following operation is performed some number of times:

Operation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.

Here, |X| denotes the length of the string X.

Constraints

2 \leq |S| \leq 100

|S| = |T|

S and T consist of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

If S equals T after rotation, print Yes; if it does not, print No.

Sample Input 1

kyoto
tokyo

Sample Output 1

Yes

In the first operation, kyoto becomes okyot.

In the second operation, okyot becomes tokyo.

Sample Input 2

abc
arc

Sample Output 2

No

abc does not equal arc after any number of operations.

Sample Input 3

aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Sample Output 3

Yes

Solution in C++14 (GCC 5.4.1) (judge verdict: Runtime Error)

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void f( char *p )
{
    int i=0,q=0,h,huan;
    while(p[i]!='\0')
        i++;
    h=i-1;
    while(q<=h)
    {
        huan=p[q];
        p[q]=p[h];
        p[h]=huan;
        q++;
        h--;
    }
    return ;
}
int main()
{
	char s[100],s1[100],a[100],s2[100],b[100];
	
	while(scanf("%s %s",s,s1)!=EOF)
	//printf("%s %s",s,s1);
	{
	strcpy(s2,s);
	int len=strlen(s),flag=0,h=0;
 if(strcmp(s,s1)==0)flag=1;
	for(int i=len-1,h=0;i>=0;i--,h++)
	{ memset(b,0,sizeof(b));
		a[h]=s[i];
		s2[i]='\0';
		
		strcpy(b,a);
		f(b);
	strcat(b,s2);
		//printf("%s\n",b);
		if(strcmp(b,s1)==0)
		{
		flag=1;
		break;	
		}
	}
	if(flag==1)printf("Yes\n");else printf("No\n");
	memset(s,0,sizeof(s));
	memset(s1,0,sizeof(s1));
	memset(s2,0,sizeof(s2));
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
}
}