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



Sample input:
kyoto
tokyo


Sample output:
Yes

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())

ok = False
for i in range(len(s)):
  s = s[-1] + s[:-1]
  if s == t:
    ok = True
    break
if ok:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a=input()
b=input()
ans="No"
for i in range(len(a)):
  k=1
  for j in range(len(a)):
    j=(j+i)%len(n)
    if a[j]!=b[j]:
      k=0
      break
  if k==1:
    ans="Yes"
    break
    
print(ans)

Submission status: Runtime Error

Solution code:
def solve():
    s = input()
    t = input()
    for i in range(len(s)):
        if t == s[i:] + s[:i]:
            return True
        else False
if solve():
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
import deque from collections
s=list(input())
s=deque(s)
t=input()
fot i in range(len(s)):
  if ''.join(s)==t:
    print("Yes")
    exit()
  s.append(s.popleft())
print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = input()

for i in range(len(S)):
	S = S[1:] + S[0]
    
	if S == T:
		c += 1
    
if c != 0:
	print('Yes')

else:
	print('No')

Submission status: Runtime Error

Solution code:
S = input()
T = input()

if set(S)!=set(T):
    ans = 'No'

for i in range(len(S)):
    if ans:
        break
    U = S[i:]+S[:i]
    if U==T:
        ans = 'Yes'

if not ans:
    ans = 'No'

print(ans)

Submission status: Runtime Error

Solution code:
S = input()
T = input()

if set(S)!=set(T):
    ans = 'No'

for i in len(S):
    if ans:
        break
    U = S[i:]+S[:i]
    if U==T:
        ans = 'Yes'

if not ans:
    ans = 'No'

print(ans)

Submission status: Runtime Error

Solution code:
S=list(input())
T=list(input())
S=S+S
ans='No'
fot i in range(len(T)):
  if S[i:len(T)]==T:
    ans='Yes'
    break
print(ans)

Submission status: Runtime Error

Solution code:
s=list(input())
t=list(input())
for i in range(len(s)):
  if s==t:
    print("Yes")
    exit()
  s=s[1:].append(s[0])
print("No")

Submission status: Runtime Error

Solution code:
s=input()
t=input()
if s.sort() == t.sort():
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    l = list(map(int, lines.pop(0).split(' ')))
    l.sort()
    print(l[2] - l[0])

#
# main
#

# 1. use list instead of stdin
# 2. use stdin

lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Submission status: Runtime Error

Solution code:
vs=input()
t=input()
print("Yes" if t in s*2 else "No")

Submission status: Runtime Error

Solution code:
s=str(input())
t=str(input())
ans='No'
if s==t:
  ans='Yes'
for i in range(len(s)):
  s.append(s[0])
  if s==t:
    ans='Yes'
print(ans)

Submission status: Runtime Error

Solution code:
S = str(inpiut())
T = str(input())

S = S+S
if T in S:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
s = [*input()]
t = [*input()]
flg = 0

for i in range(len(s)):
    if s != t:
        s.append(s[0])
        s.remove(s[0])
    else:
        flg = 1
        break

if flg == 0:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
print(max(A)-min(A))

Submission status: Runtime Error

Solution code:
a=input()
b=input()
A=a*2
d= b in A
if d=="True"
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a=input()
b=input()
A=a*2
d= b in A
if d="True"
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s=input()
t=input()
for i in len(s):
  tmp=s[i:]+s[:i]
  if tmp==t:
    print('Yes')
    exit()
print('No')

Submission status: Runtime Error

Solution code:
import sys
s1=input ()
s2=input ()
for _ in range(len (s1)):
  if s1==s2:
    print ('Yes ')
    sys.exit ()
  s1=s1[-1]+s[:-1]
print ('No ')

Submission status: Runtime Error

Solution code:
a = list(input()).sorted()
b = list(input()).sorted()
if a == b:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = input()

for i in range(len(S)):
	if T==S
		print("Yes")
		break
	S = S[-1]+ S[:-1]
else:
	print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = input()

for i in range(len(S)):
	if T==S
		print("Yes")
		break
	S = S[-1]+ S[0:-1]
else:
	print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = input()

for i in range(len(S)):
	if S==T
		print("Yes")
		break
	S = S[-1]+ S[:-1]
else:
	print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = input()

for i in range(len(S)):
	s = S[-1]
	S'= S[0:-1]
	if S==T
		print("Yes")
		break
	S = s + S'
else:
	print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = input()

for i in range(len(S)):
	s = S[len(S)]
	S'= S[0:-1]
	if S==T
		print("Yes")
		break
	S = s + S'
else:
	print("No")

Submission status: Runtime Error

Solution code:
s = input()
t = input()
flag = False
for i in range(len(i)):
  if s == t:
    flag = True
    break
  s = s[1:] + s[0]
print("Yes" if flag else "No")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
s = str(input())
t = str(input())

slen = len(s)
tlen = len(t)

if slen != tlen:
    print('No')
    break

for i in range(slen):
    if s == t:
        print("Yes")
        break
    s = s[-1] + s[:-1]

Submission status: Runtime Error

Solution code:
a = str(input())
b = str(input())
check = 0
for i in range(len(a)):
  if a == b:
    check = 1
    break
  else:
    a = a[len(a)] + a[0:len(a)]
    
if check == 0:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
a = str(input())
b = str(input())
check = 0
for i in range(len(a)):
  if a = b:
    check = 1
    break
  else:
    a = a[len(a)] + a[0:len(a)]
    
if check = 0:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
for i in S:
    s = ''
    x = i
    s += S[1::1]
    s += x
    S = S[1::1] + S[0]
    
    if s == T:
        print('Yes')
        break
else:
    print('No')

Submission status: Runtime Error

Solution code:
s=list(input())
t=list(input())
ans="No"
for i in range(n):
    s=list(s[n])+s[0:n]
    if s==t:
        ans="Yes"
        break
print(ans)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

string s,t;
int i;

int main(){
    cin >> s;
    cin >> t;

    s = s + s;
    if(s.find(t) != s.npos){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

string s,t;
int si;
int i;

int main(){
    cin >> s >> t;

    s = s + s;
    if(s.find(t) != s.npos){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}

Submission status: Runtime Error

Solution code:
s, t = input(), input()
for i in range(len(s)):
    if t = s[len(t)-i:]+s[i:len(t)-i]:
        print('Yes')
        break
else:
    print('No')

Submission status: Runtime Error

Solution code:
import sys

s = input()
t = input()
for i in range(len(s)):
    s = s[-1] + s[:-1]
    if t == s:
        print('Yes')
        sys.exit(1)
print('No')

Submission status: Runtime Error

Solution code:
import sys

s = input()
t = input()
for i in range(len(s)):
    s = s[-1] + s[:-1]
    print(s)
    if t == s:
        print('Yes')
        sys.exit(1)
print('No')

Submission status: Runtime Error

Solution code:
S=input()
T=input()
S=S[::-1]
if S=T:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Submission status: Runtime Error

Solution code:
a=input()
b=input()
for i in range(len(a)):
    if a==b:
        print("Yes")
        break
    
    a=a[-1]+a
    a=a[:len(a)-1]
else:
    print("No"

Submission status: Runtime Error

Solution code:
S = input()
T = input()

for i in range(len(S)):
    if S == T:
        print('Yes')
        break
    else:
        S[:] = T[-1] + T[1:]
else:
    print('No')

Submission status: Runtime Error

Solution code:
moji_S=input()
moji_T=input()

flag=0
for i in range(len(moji_S)):
	if moji_S==moji_T:
		flag =1
		break
	s=s[-1]+s[0:len-1]
if flag:
	print("Yes")
else:
	print("No")

Submission status: Runtime Error

Solution code:
s = input()
t = input()
t2 = t[-1] + t[1:]
while t2 != t:
  if s == t2:
    print("yes")
    return 0
  t2 = t[-1] + t[1:]
print("no")

Submission status: Runtime Error

Solution code:
import copy
s = input()
t = input()
t2 = t[-1] + t[1:]
while t2 != t:
  if s = t2:
    print("yes")
    return 0
  t2 = t[-1] + t[1:]
print("no")

Submission status: Runtime Error

Solution code:


#if WATCH_RUNTIME
	#include <ctime>
	clock_t startTime;
#endif

#include <cstdio>
#include <cstring>

int main(void)
{
	#if DEBUG 
	freopen("_in","r",stdin);
	#endif
	#if WATCH_RUNTIME
	startTime=clock();
	#endif
	bool winFlag;
	int i,j,N;
	char msg[200],patten[100];
	scanf("%s",msg);
	scanf("%s",patten);
	N=strlen(msg);
	for(i=0;i<N;i++)
	{
		msg[N+i]=msg[i];
	}
	msg[N+i]='\0';
	for(i=0;i<N;i++)
	{
		winFlag=true;
		for(j=0;patten[j];j++)
		{
			if(patten[j]!=msg[i+j])
			{
				winFlag=false;
				break;
			}
		}
		if(winFlag)
			break;
	}
	printf("%s\n",winFlag?"Yes":"No");

	#if WATCH_RUNTIME
	printf("----------\n");
	printf("\n+===============+\n");
	printf("|RUNTIME =%3dms.|\n",clock()-startTime);
	printf("+===============+\n");
	#endif

	return 0;
}

Submission status: Runtime Error

Solution code:
s=input()
t=input()
if t in [s[i:]+s[:i] for i in range(len(s)]:
	print('Yes')
else:
	print('No')

Submission status: Runtime Error

Solution code:
s = input().strip()
t = input().strip()
print ("Yes" if any(s[i:] + s[:i]  == t for i in range(len(s)) else "No")

Submission status: Runtime Error

Solution code:
s = input()
t = input()

for _ in range(len(s)):
    if s = t:
        print('Yes')
        exit()
    s = s[-1]+s[:-1]
print('No')

Submission status: Runtime Error

Solution code:
a=input()
b=input()
printf('Yes' if a in (b*2) else 'No')

Submission status: Runtime Error

Solution code:
import numpy as np

s = list(input())
t = list(input())

i = 0
if len(s) != len(t):
    print("No")
else:
    while True:
        s = np.roll(s,-1)
        i += 1
        if s == t:
            print("Yes")
            break
        elif i >= len(s):
            print("No")
            break

Submission status: Runtime Error

Solution code:
s=list(input())
t=list(input())
flag=False
cnt=0
if sorted(s)==sorted(t):
  a=s.index(t[0])
  for i in range(len(s)):
    b=i+a
    print(b)
    if b>=len(s):
      b-=len(s)
    if s[b]==t[i]:
      cnt+=1

if cnt==len(S):
  flag=True
print('Yes' if flag else 'No')

Submission status: Runtime Error

Solution code:
import numpy as np
a_in = input()
b_in = input()
a = list(a_in)
b = list(b_in)
an = np.array(a)
bn = np.array(b)
no =0
for i in an:
  if ln(bn.where(i)) == 1:
    pass
  else:
  	print(No)
    no = 1
    break
if no == 0:
  print(Yes)

Submission status: Runtime Error

Solution code:
S = input()
T = input()
flg = True
for i in range(0,len(S)):
    if S == T:
        print('Yes')
        break
    else:
        T = T[len(T)]+T[1:]
else:
    print('No')

Submission status: Runtime Error

Solution code:
S = input()
T = input()

for i in range(0,len(S)):
	if S[i] == T[-i]:
		continue
	else:
		print('No')
		return

print('Yes')

Submission status: Runtime Error

Solution code:
s = input()
t=input()
keyword=s[0]
start=t.find( keyword)
circulate=t[start::]+t[0:start]
print("Yes") if s==circulate else print("No
")

Submission status: Runtime Error

Solution code:
import sys

s = input()
t = input()

a = int(len(s))

for i in range(0,a) :
    s = s[:a-1:]+s[a-1::]
    if s == t :
        print("Yes")
        sys.exist()

print("No")

Submission status: Runtime Error

Solution code:
input_a = input()
input_b = input()

a = dict.fromkeys(set(input_a), 0)
for x in input_a:
    a[x] += 1
a = sorted(a.items())

b = dict.fromkeys(set(input_b), 0)
for x in input_b:
    b[x] += 1
b = sorted(b.items())

print('Yes' if all([a[i][0] == b[i][0] and a[i][1] == b[i][1] for i in range(len(a))]) else 'No')

Submission status: Runtime Error

Solution code:
import sys
s = input()
t = input()
for i in len(s):
  ok = 1
  for j in len(s):
    if s[(i+j)%len(s)] != t[j]:
      ok = 0
  if ok == 1:
    print("Yes")
    sys.exit()
print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = input()

if S == T:
  print("Yes")
  exit()

nibun = int(len(S)/2)

startline = 0
while nibun > 1:
  if not S[0:nibun] in T:
    startline = ninbun
  nibun = int(nibun / 2)

for i in range(startline, len(S)):
  if not S[0:i] in T:
      sep = i
      break

try:
  sep
except NameError:
  print("No")
  exit()

if S[sep:len(S)] in T[0:len(S)-4+1]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
S = [*input()] # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if word == T:
        print('Yes')
        break
    elif i == j:
        print('No')
        break

Submission status: Runtime Error

Solution code:
import sys

s = list(input())
t = list(input())

for i in range(len(s)):    
    if s == t:
        print("Yes")
        sys.exit(1)

    tmp = s.pop(len(s)-1)
    s.insert(0, tmp)

if s == t:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
S = input().lower
T = input().lower

for i in range(len(S)):
  S = S[len(S)-1:len(S)] + S[0:len(S)-1]
  if S == T:
    break
if S == T:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
S = [*input()] # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if(word == T):
        print('Yes')
        break
    elif(i == j):
        print('No')
        break

Submission status: Runtime Error

Solution code:
S = [*input()] # これで文字列を一文字にできる
T = input()
for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if(word == T):
        print('Yes')
        break
    elif(i == j):
        print('No')

Submission status: Runtime Error

Solution code:
import sys

s = list(input())
t = list(input())

for i in range(len(s)):
    tmp = s.pop(len(s)-1)
    s.insert(0, tmp)

    if s == t:
        print('Yes')
        sys.exit(1)

print('No')

Submission status: Runtime Error

Solution code:
import sys

S = [*input()] # これで文字列を一文字にできる
T = input()
for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if(word == T):
        print('Yes')
        sys.exit()
print("No")

Submission status: Runtime Error

Solution code:
S = input().lower
T = input().lower
for i in range(len(S)):
  S = S[len(S)-1:len(S)] + S[0:len(S)-1]
  if S == T:
    break
if S == T:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a=input()
b=input()
z=len(a)
for i in range(0,z):
  if a==b[i:]+b[:i] : 
    print("Yes")
    Exit(0)
print("No")

Submission status: Runtime Error

Solution code:
import sys

s = list(input())
t = list(input())

for i in range(len(s)):
    tmp = s.pop(len(s)-1)
    s.insert(0, tmp)

    if s == t:
        print("Yes")
        sys.exit(1)

print("No")

Submission status: Runtime Error

Solution code:
S = list(input())
T = list(input())

change = []
flag = 0
get = 0

for i in range(len(S)):
  if S[0] == T[i]:
    get = 1
    for j in range(len(S) - i):
      change.append(T[j+i])
    for k in range(i):
      change.append(T[k])
      
if get == 1:
	for check in range(len(S)):
  		if S[check] != change[check]:
    		flag = 1

if flag == 1:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
from sys import stdin
S, T = stdin.readline().rstrip().split()
S = S[::-1]
if S == T:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = list(input())

change = []
flag = 0

for i in range(len(S)):
  if S[0] == T[i]:
    for j in range(len(S) - i):
      change.append(T[j+i])
    for k in range(i):
      change.append(T[k])
      
for check in range(len(S)):
  if S[check] != change[check]:
    flag = 1

if flag == 1:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
S, T = stdin.readline().rstrip().split()
S = S[::-1]
if S == T:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
S,T = str(stdin.readline().rstrip()).lower()
S = S[::-1]
if S == T:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
S,T = str(stdin.readline().rstrip()).lower()
S = S[::-1]
if S == T:
  print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
S = input()
T = input()

flag = False
s_tmp = S
for cnt in range(len(s)):
    s_tmp = s_tmp[-1] + s_tmp[:-1]
    if s_tmp == T:
        flag = True
        break

if flag:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
S,T = str(stdin.readline().rstrip()).lower()
S = S[::-1]
if S = T:
  print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a = input()
b = input()

counter = {}
for c in a:
    if not c in counter:
        counter[c] = 1
    else:
        counter[c] += 1
counter_2 = {}
for c in a:
    if not c in counter_2:
        counter_2[c] = 1
    else:
        counter_2[c] += 1
if conter == counter_2:
    print(True)
else:
    print(False)

Submission status: Runtime Error

Solution code:
# your code goes here
S = input()
T = input()

ans = False
for i in range(len(T)):
	if S[0] == T[i]:
		flag = True
		for j in range(len(S)):
			if S[j] != T[(i+j)%len(T)]:
				flag = False
				break
	if flag:
		ans = True
		break
		
if ans:
	print('Yes')
else:
	print('No')

Submission status: Runtime Error

Solution code:
S = input()
T = input()

if (len(S)%2==0)
    if T == S[::-1]:
        print("Yes")
    else:
        print("No")
else:
    if T == S[::-1]:
        print("No")
    else:
        print("Yes")