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: Accepted

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)-1] + a[0:len(a)-1]
    
if check == 0:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#二つの文字列を渡すと、文字列rotationにより一致する文字列になるかどうかを調べ、
#'Yes'または'No'を返す関数、match_rotation()を定義
def match_rotation(s,t):
    for i in s:
        s = s[1::] + s[0]
        if s == t:
            return 'Yes'
    else:
        return 'No'

#入力値読み込み
S = str(input())
T = str(input())

#関数呼び出し
print(match_rotation(S, T))

Submission status: Accepted

Solution code:
#二つの文字列を渡すと、文字列rotationにより一致する文字列になるかどうかを調べ、
#'Yes'または'No'を返す関数、match_rotation()を定義
def match_rotation(s,t):
    for i in s:
        s = s[1::] + s[0]
        if s == t:
            return 'Yes'
            break
    else:
        return 'No'

#入力値読み込み
S = str(input())
T = str(input())

#関数呼び出し
print(match_rotation(S, T))

Submission status: Accepted

Solution code:
import sys
import numpy as np

S = np.array([c for c in input()])
T = np.array([c for c in input()])

for i in range(S.shape[0]):
    if np.all(np.roll(S, i) == T):
        print("Yes")
        sys.exit()

print("No")

Submission status: Accepted

Solution code:
#Sの文字数分、Sの先頭を後ろに持っていき、Tと一致するか確認する
#(問題では後ろの数字を前に持ってきていましたが、
# こちらの方がシンプルになると思ったので、先頭を後ろに持ってきています。)

#入力値読み込み
S = str(input())
T = str(input())

#Sの文字数分、Sの先頭の文字を最後尾に持っていく
for i in S:
    S = S[1::] + S[0]
    
    #もしSとTが一致したらYes, break
    if S == T:
        print('Yes')
        break
#もしBreakが起こらなかったらNo
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

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: Accepted

Solution code:
s = input()
listS =list(s)
length = len(listS)
listT = list(input())
listT.extend(listT)

index=0
flag =0
while index<length:
    index2=0
    word=""
    while index2<length:
        word+=listT[index+index2]
        index2+=1
    if word == s:
        flag =1
        print("Yes")
        break
    else:
        index+=1
if flag==0:
    print("No")

Submission status: Accepted

Solution code:
s,t = [list(input()) for i in range(2)]
for i in range(len(s)):
  s.insert(0,s[-1])
  s.pop(-1)
  if s == t:
    print("Yes")
    break
  elif i == len(s)-1:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s_list = list(input())
t_list = list(input())
n_oneroop = len(s_list)

for _ in range(n_oneroop):
    s_list = [s_list[-1]] + s_list[:-1]
    if s_list == t_list:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

flag = False
l = len(t)
for i in range(l):
	if s[i:i+l] == t:
		flag = True
print('Yes' if flag else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(101):
    a = s[-1]
    s = a + s[:-1]
    if s == t:
        print("Yes")
        exit()
    
print("No")

Submission status: Accepted

Solution code:
print('Yes'if input()in input()*2else'No')

Submission status: Accepted

Solution code:
a=input();b=input();print(['No','Yes'][b in a*2])

Submission status: Accepted

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

s=s*2

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

Submission status: Accepted

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

start=0
while True:
    i = t.find(s[0], start)
    if i == -1:
        print('No')
        exit(0)
    elif t[i:] + t[:i] == s:
        print('Yes')
        exit(0)
    else:
        start = i+1

Submission status: Accepted

Solution code:
S=list(input())
T=list(list(input()))
ans='No'
def counter(i,max):
    a=[]
    for  j in range(i,max+1):
        a.append(j)
    for k in range(i):
        a.append(k)
    return a
for i in range(len(S)):
    a=[]
    for j in counter(i,len(S)-1):
        a.append(S[j])
    if(a==T):
        ans='Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    s = str(input())
    t = str(input())
    pos = 0
    for i in range(len(s)):
        if s[i] == t[0]:
            pos = i
            break
    l = pos
    pos = 0
    for i in range(l,len(s)):
        if(s[i] != t[pos]):
            print("No")
            return 0
        pos = pos + 1
    if pos != len(t):
        for i in range(len(s)):
            if(pos >= len(t)):
                break
            if(s[i] != t[pos]):
                print("No")
                return 0
            pos = pos + 1

    print("Yes")
main()

Submission status: Accepted

Solution code:
s,t = [input() for i in range(2)]
n = len(s)
for i in range(n):
    temp = s[n-1]
    s = s[:-1]
    s = temp + s
    if s == t:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
S = raw_input()
T = raw_input()
a = []
for i in range (len(S)):
  A = S[len(S)-1]
  B = S[:len(S)-1]
  C = A+B
  a.append(C)
  S = C
if T in a:
  print "Yes"
else:
  print "No"

Submission status: Accepted

Solution code:
S = input()
T = input()
word = [x for x in T]
for i in range(len(word)):
    a = word[0]
    word.append(a)
    word.remove(a)
    if S == ''.join(word):
        break
    else:
        pass
if S == ''.join(word):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    m = "Yes" if t in s + s else "No"
    print(m)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input()
ori = input()
loop = 1000
while loop != 0:
    if x == ori:
        print("Yes")
        break
    y = [y for y in x]
    if loop == 1000:
        loop = len(y)
    move = y.pop(0)
    y.append(move)
    x = "".join(y)
    loop -= 1
if loop == 0:
    print("No")

Submission status: Accepted

Solution code:
#coding: utf-8

s = raw_input()
t = raw_input()

n = len(s)
for i in range(n):
    for j in range(n):
        if s[(i+j)%n] != t[j]:
            break
        elif j == n-1:
            print "Yes"
            exit()
print "No"

Submission status: Accepted

Solution code:
A = input()
B = input()
n = len(A)

if A == B:
    print("Yes")
    
else:
    for i in range(1,n):    
        C = A[-i:] + A[:n-i]
        if C == B:
            print("Yes")
            break
    else:      
        print("No")

Submission status: Accepted

Solution code:
#103b
s=list(input())
t=list(input())

if s==t:
    print('Yes')
    exit()

for _ in range(len(s)):
    s.insert(0,s[-1])
    del s[-1]
    if s==t:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
s = raw_input()
t = raw_input()
ans = 'No'
for i in range(0, len(s)):
	top = s[i:]
	bottom = s[:i]
	if t == top + bottom:
		ans = 'Yes'
		break
print ans

Submission status: Accepted

Solution code:
def solution(a, b):
    #todo: check if a and b are valid
    if (a + a[:-1]).find(b) >= 0:
        return 'Yes'
    else:
        return 'No'

def main():
    a = raw_input().strip()
    b = raw_input().strip()
    print solution(a, b)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

S = list(s)
T = list(t)

count = 0
for i in range(len(S)):
    S.insert(0,S[len(S)-i-1])
    ans = S[0:len(S)-i-1]
    if ans == T:
        print("Yes")
        count = 1
        break
if count == 0:
    print("No")

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()
n = len(s)
for i in range(n):
    for j in range(n):
        if s[j] == t[(i + j) % n]:
            continue
        else:
            break
    else:
        print('Yes')
        sys.exit(0)
    continue
print('No')

Submission status: Accepted

Solution code:
# encoding: utf-8
S, T = [input() for i in range(2)]

for i, si in enumerate(S):
    if si == T[0]:
        if S[i:] + S[:i] == T:
            print("Yes")
            break
else:
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
S = input()
T = input()
for i in range(100):
    Scheck=S[i+1:]+S[0:i+1]
    if(Scheck==T):
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
S=input()
T=input()
S=S*2
if T in S:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# coding: utf-8

import sys

def main():
    s1 = input()
    s2 = input()
    count = 0 # 文字列の操作を行った回数を記録する

    while True:
        if count == len(s2):
            break
        if s1 == s2:
            print("Yes")
            break
        s2 = s2[-1:] + s2[0:-1]
        count = count + 1

    if count == len(s2):
        print("No")

    return 0

if __name__ == "__main__":
    sys.exit(main())

Submission status: Accepted

Solution code:
# coding: utf-8
S = input()
T = input()
if(S==T):
    print("Yes")
    exit()
for i in range(100):
    Scheck=S[i+1:]+S[0:i+1]
    if(Scheck==T):
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
L = []
for i in S :
    S.replace(i,"")
    S = S + i
    L.append(S)
if T in S :
    print("Yes")
else :
    print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
LS = list(S)
hantei = False

for i in range(len(S)):
    temp1 = LS[0]
    LS[0] = LS[-1]
    #print("i = ", i, "回目：", "".join(LS))
    for j in range(1, len(S)):
        if j % 2 != 0:
            temp2 = LS[j]
            LS[j] = temp1
            #print("j = ", j, "回目：", "".join(LS))
        else:
            temp1 = LS[j]
            LS[j] = temp2
            #print("j = ", j, "回目：", "".join(LS))
    LStoS = "".join(LS)
    #print(LStoS)
    if LStoS == T:
        hantei = True
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
S = input()
T = input()
S = S + S

for i in range(len(T)):
    U = S[i:i+len(T)]
    if U==T:
        print("Yes")
        sys.exit(0)
print("No")

Submission status: Accepted

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

for _ in range(len(s)):
    if s == t:
        flag = True
        break

    s = s[-1] + s[:-1]

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

Submission status: Accepted

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

def revolve(letters):
    last_l=letters[-1]
    letters_1=letters[:-1]
    letters_new=last_l+letters_1
    return letters_new


count=0
word=S
while count<=len(S):
    revolve(word)
    if revolve(word)==T:
        print("Yes")
        break
    else:
        if count==len(S):
            print("No")
            break
        else:
            word=revolve(word)
            count+=1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = input()
T = input()

ans = "No"

X = len(S)

for i in range(X):
    if S == T:
        ans = "Yes"
        break

    S = S[X-1] + S[0:X-1]
    
print(ans)

Submission status: Accepted

Solution code:
s=input()
t=input()
b=[0]*160
c=[0]*160
res=False
for i in range(len(s)):
    b[ord(s[i])]+=1
    c[ord(t[i])]+=1
for i in range(160):
    if b[i]!=c[i]:
        res=True
if res:
    print("No")
else:   
    l=len(s)
    n=l
    while n>0:
        s=s[l-1]+s[:l-1]
        if s==t:
            res=False
            print("Yes")
            break
        else:
            res=True
        n-=1
    if res:
        print("No")

Submission status: Accepted

Solution code:
def rotate(argstr):
    return argstr[len(argstr)-1] + argstr[0:len(argstr)-1]

str1 = input()
str2 = input()
ans = 'No'

if str1 == str2: ans = 'Yes'

for i in range(0, len(str1) - 1):
    str1 = rotate(str1)
    if str1 == str2: ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    s = S()
    t = S()
    l = len(s)
    for i in range(l):
        if s == t[i:] + t[:i]:
            return 'Yes'
    return 'No'


print(main())

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 'No'
for i in range(len(S)):
    if S[i:] == T[0:(len(S) - i)] and S[0:i] == T[len(S)-i:]:
        ans = 'Yes'
        break

print(ans)

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
T.extend(T[:-1])
for i in range(len(S)):
  if T[i:i + len(S)] == S:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

flag = False
for i in range(len(S)):
    T = T[1:] + T[:1]
    if S == T:
        flag = True
        break

print('Yes' if flag else 'No')

Submission status: Accepted

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

def roll(_str):
  return _str[-1] + _str[:-1]

s_alt = s
for _ in range(len(s)):
  if t == s:
    print('Yes')
    quit()
  s = roll(s)
print('No')

Submission status: Accepted

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

def f(S, T):
  for i in range(len(S)):
    if S[i:] + S[:i] == T:
      return 'Yes'
  return 'No'

print(f(S,T))

Submission status: Accepted

Solution code:
s=input()
t=input()
length=len(s)
flag=0

for i in range(length):
    j=i
    for k in range(length):
        if s[j%length]!=t[k]:
            break
        if k==length-1:
            flag=1
        j+=1
            
if flag==1:
    print("Yes")
elif flag==0:
    print("No")

Submission status: Accepted

Solution code:
str=list(input())
str2=list(input())
if(str2==str):
    print("Yes")
    exit()
for i in range(len(str)):
    var=str[-1]
    del str[-1]
    str.insert(0,var)
    if(str==str2):
        print("Yes")
        flag=True
        exit()
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def equals(s, t):
    for i in range(len(s)):
        rotated = s[-i:] + s[0:-i]
        if rotated == t:
            return True
    return False


if __name__ == '__main__':
    s = input()
    t = input()
    print('Yes') if equals(s, t) else print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
for i in range(200):
  s = s[-1] + s[:-1]
  if s == t:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

def hantei(S, T):
    for i in range(len(T)):
        if S == T:
            print("Yes")
            break
        l = list(S)
        l.append(l[0])
        del l[0]
        S = ''.join(l)
        if i == len(T)-1:
            print("No")
            
hantei(S, T)

Submission status: Accepted

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

n = len(S)
e = 0
for i in range(n):
    R = S[i:n] + S[0:i]
    if T == R:
        print("Yes")
        e = 1
        break

if e == 0:
    print("No")

Submission status: Accepted

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

if len(S) != len(T):
  print("No")
  exit()

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

print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
for i in range(len(s)):
	if (s == t):
		print("Yes")
		exit(0)
	t = t[-1] + t[:-1]

print("No")

Submission status: Accepted

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

b = False

for i in range(len(S)):
    S = S[-1]+S[:len(S)-1]
    if(S==T):
        b=True
        break

if b:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
x = len(S)
a = 0

while S != T:
    S.append(S.pop(0))
    a += 1
    if x == a:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
ans = 'No'
for i in range(len(S)):
  if S == T:
    ans = 'Yes'
  else:
    S.insert(0, S[-1])
    S.pop()
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

alls = []
for sl in range(len(s)):
  alls.append(s[sl:] + s[:sl])

if t in alls:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

for i in range(len(s)):
    s = s[len(s) - 1:] + s[0:len(s) - 1]
    if s == t:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

Solution code:
n=input()
m=input()
n*=2
if m in n:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

l1 = sys.stdin.readline()
A = list(l1.strip())
l2 = sys.stdin.readline()
B = list(l2.strip())

flag = False

for i in range(0, len(A)):
  C = B[i:] + B[:i]
  # print(C)
  if A == C:
    flag = True
    break
  # C = []

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

Submission status: Accepted

Solution code:
S = input()
T = input()
S_l = len(S)
while S_l != 0:
    if S == T:
        print("Yes")
        break
    S = S[-1]+S[0:-1]
    S_l -= 1
if S_l == 0:
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8

def checkStr(S, T):
    for i in range(len(T)):
        if S == (T[i:] + T[:i]):
            return "Yes"
    return "No"

if __name__ == "__main__":
    S = input()
    T = input()
    print(checkStr(S, T))

Submission status: Accepted

Solution code:
# coding: utf-8

def checkStr(S, T):
    for i in range(len(T)):
        if S == (T[i:] + T[:i]):
            return "Yes"
    return "No"

if __name__ == "__main__":
    S = input()
    T = input()
    print(checkStr(S, T))

Submission status: Accepted

Solution code:
import sys 
import math

#X = int(input())
#a = list(map(int, input().split(" ")))
#a = [0 for i in range(X+1)]
S = input()
T = input()

flag = False

for i in range(len(S)):
    cmp_str = S[len(S)-1] + S[0:len(S)-1]
    S =  S[len(S)-1] + S[0:len(S)-1]
    #print(cmp_str)
    if(cmp_str == T):
        flag = True
        break

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

Submission status: Accepted

Solution code:
s = input()
t = input()
n = len(s)
f = [False]
i = 0
for i in range(0,n):
    if (f[0] == True):
        break
    if (s == t):
        f[0]=True
        break
    else:
        p = s[0]
        s=s.lstrip(p)
        s=s+p


if (f[0]==True):
    print("Yes")
if (f[0]==False):
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def main():
    S = input()
    T = input()
    for i in range(len(S) + 1):
        s = S[i:] + S[:i]
        if s == T:
            print(Yes)
            return
    print(No)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stderr
from functools import reduce
from collections import deque
from operator import add
def f(): return [int(i) for i in input().split()]
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(repr(item))
        stderr.write(sep)
    stderr.write(end)

s = deque(input())
t = deque(input())
loop = len(s)
for i in range(loop):
    if s == t:
        print("Yes")
        break
    s.append(s.popleft())
else:
    print("No")

Submission status: Accepted

Solution code:
s1 = input()
s2 = input()
l = len(s1)
for i in range(l):
    if s1 == s2:
        print('Yes')
        break
    t = s1[0]
    s1 = s1[1:] + s1[0]
else:
    print('No')

Submission status: Accepted

Solution code:
a = str(input())
b = str(input())
p=0
if len(a) != len(b):
    print("No")
else:
    for j in range(len(a)):
        s=b[:1]
        b=b+s
        b=b[1:]
        #print(b)
        if a==b:
            p=1
    if p==1:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
class Queue:
    def __init__(self):
        self.items = []
 
    def enqueue(self, item):
        self.items.insert(0, item)
 
    def dequeue(self):
        return self.items.pop()
 
    def size(self):
        return len(self.items)
 
    def self(self):
        return self.items
 
s = raw_input()
t = raw_input()
q = Queue()
 
j = 0
S = list(s)
L = len(s)
while j < L :
    q.enqueue(S[L - (j + 1)])
    j += 1
 
flag = False
i = 0
while i < q.size():
    x = q.dequeue()
    q.enqueue(x)
    if (list(t) == q.self()):
        flag = True
        break
    i += 1
 
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

if t.find(s) !=-1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

find =False
for i in range(len(s)):
    if s == t:
        print("Yes")
        find = True
        break

    s.insert(0,s[-1])
    s.pop()
if not find:
    print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
T = T + T
index = T.find(S)
if index == -1:
	print("No")
else:
	print("Yes")

Submission status: Accepted

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

ans = False
for i in range(len(S)):
    if S == T:
        ans = True
        break
    S = S[1:] + S[0:1]


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

Submission status: Accepted

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: Accepted

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

if len(a)/2!=len(b):
  print("No")
else:
    for i in range(len(b)):
        if b==a[i:i+len(b)]:
            print("Yes")
            break
        if i==len(b)-1:
            print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#! python3

moji_S=input()
moji_T=input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
str = input()
str2 = input()

str3 = str2*2

if str3.find(str) > -1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

S = input()
T = input()

rotatable = False
for i in range(len(S)):
    if S == T:
        rotatable = True
        break
    S = S[-1] + S[0:-1]

answer = 'Yes' if rotatable else 'No'
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    word_A = input()
    word_B = input()
    for i in range(len(word_A)):
        if (word_A != word_B):
            word_A = word_A[1:] + word_A[0]
        else:
            print("Yes")
            return
    print("No")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

s=arr_data[0][0]
t=arr_data[1][0]


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
for i in range(len(S)):
    if S[i:] + S[:i] == T:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input();
print("Yes"if input() in a*2 else"No")

Submission status: Accepted

Solution code:
X = input()
Y = input()
for i in range(len(Y)):
    if X == Y:
        print('Yes')
        break
    else:
        Y = Y[1:] + Y[0]
    if i == len(Y) - 1:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
import sys
if __name__ == "__main__":
    s = list(input())
    t = list(input())
    for tmp in range(0, len(t)):
        factor = []
        factor.append(s.pop())
        factor.extend(s)
        s = factor
        if ''.join(factor) ==''.join(t):
            print("Yes")
            sys.exit(0)
    else:
        print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
l = len(S)
for i in range(l+1):
	S = (S[-1] + S[:l-1])
	if S == T:
		print("Yes")
		exit(0)

print("No")