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:
S = list(input())
T = list(input())

ans = 'No'
for i in range(len(S)):
    s = S.pop()
    S.insert(0, s)
    if S == T:
        ans = 'Yes'
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
print(["No","Yes"][t in s*2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S, T = map(str, [input() for i in range(0, 2)])
print("Yes" if str(T + T).find(S) >= 0 else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

S = deque(list(input().rstrip()))
T = deque(list(input().rstrip()))

for _ in range(len(S)):
	if S == T:
		print('Yes')
		break
	S.append(S.popleft())
else:
	print('No')

Submission status: Accepted

Solution code:
str0 = input().strip()
str1 = input().strip()
if not len(str0) == len(str1):
  print('No')
  exit()
str0 += str0
if str1 in str0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
def main(S, T):
    tmp = S
    for i in list(S):
        if tmp == T:
            print('Yes')
            exit()
        tmp = tmp[-1] + tmp[:-1]
    print('No')


if __name__ == '__main__':
    main(input().strip(), input().strip())

Submission status: Accepted

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

Submission status: Accepted

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

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

print("Yes" if is_ok else "No")

Submission status: Accepted

Solution code:
print("Yes" if input() in input()*2 else "No")
#copy code

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
c=True
for x in range(len(s)):
    temp=s[(len(s)-x):]+s[:(len(s)-x)]
    if(temp==t):
        print("Yes")
        c=False
        break
if(c):
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

print('Yes' if s in t else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(len(S)):
    if(S==T):
        print("Yes")
        quit()
    a=S[0]
    S.pop(0)
    S.append(a)

print("No")

Submission status: Accepted

Solution code:
S = str(input())
T = str(input()) 
S_rot = S+"A"
for i in range(len(S)):
    if i == 0:
        S_rot = S_rot.replace("A",S_rot[0])
        S_rot = S_rot[1:]
    else:
        S_rot = S_rot+"A"
        S_rot = S_rot.replace("A",S_rot[0])
        S_rot = S_rot[1:]

    if S_rot == T:
        print("Yes")
        exit()
    else:
        continue
print("No")

Submission status: Accepted

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

ans = "No"
for _ in S:
    if T == S:
        ans = "Yes"
    T = T[-1] + T[:-1]
print(ans)

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
for _ in range(len(s)):
    s.insert(0,s.pop())
    if s == t:
        print('Yes')
        exit()
else: print('No')

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
S = input()
T = input()
count = 0
while count < len(S):
    S = S[len(S)-1] + S[:len(S)-1]
    count += 1
    if S == T:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
import numpy as np
def piyo():
    s = np.array(list(input()),dtype=str)
    a = np.array(list(input()),dtype=str)
    for _ in s:
        s = np.roll(s, 1)
        if (s==a).all():
            print("Yes")
            return
    print("No")
        
if __name__ == '__main__':
    piyo()

Submission status: Accepted

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


def main():
    """Function."""
    s = str(input())
    t = str(input())

    flag = 0
    for _ in range(len(s)):
        temp = s[-1] + s[:-1]
        if temp == t:
            flag = 1
            break
        s = temp

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

S = input()
T = input()
S +=S
T +=T
for i in range(0,len(S)//2):
    flag = True
    for k in range(0,len(S)//2):
        if T[k+i] != S[k]:
            flag = False
    if flag == True:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
count=0
for i in range(len(S)):
    if(S==T):
        print("Yes")
        count=1
        break
    else:
        a = S[0]
        S.append(a)
        S = S[1:]

if(count!=1):
    print("No")

Submission status: Accepted

Solution code:
def main():
    s = input()
    t = input()
    ss = s + s
    n = len(s)
    for i in range(0, n):
        if t == ss[i:(i + n)]:
            print('Yes')
            return
    print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
ans = 0
for i in range(len(s)):
    if s == t:
        ans = 1
        break
    a = s[0]

    for j in range(len(s)-1):
        s[j] = s[j+1]

    s[-1] = a

if ans == 0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
p = s * 2
ctr = 0
for i in range(len(p) - len(t)):
    if p[i:i+len(t)] == t:
        print('Yes')
        ctr = 1
        break
if ctr == 0:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
import sys
# N,M = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())

S = str(input())
T = str(input())
S3 = S*3
if T in S3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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


abc103_b()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

str1 = input()
str2 = input()

for i in range(len(str1)):
  if (str1 == str2):
    print('Yes')
    sys.exit()
  else:
    str1 = str1[1:] + str1[0]
    
print('No')

Submission status: Accepted

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

ls = len(s)
flag = False

for i in range(ls):
  s = s[-1:] + s[0:-1]
  #print(s)
  if s == t:
    flag = True
    break

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

Submission status: Accepted

Solution code:
def main():
    s = list(input())
    t = list(input())
    s_len = len(s)
    for i in range(s_len):
        if s == t:
            print("Yes")
            return
        tmp = s[0]
        s.pop(0)
        s.append(tmp)
    print("No")


main()

Submission status: Accepted

Solution code:
from collections import deque

a=deque(input())
b=list(input())
#print(a,b)
n=len(a)
#print(n)

flag=0
for i in range(n):
  list1=list(a)
  if list1==b:
    flag=1
  a.rotate(1)
  
print('Yes' if flag==1 else 'No')

Submission status: Accepted

Solution code:
s = str(input())
t = str(input())
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:
s = [i for i in input()]
t = [i for i in 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: Accepted

Solution code:
a=list(input())
b=list(input())
hantei=True
for i in range(len(a)):
	c=[]
	c.append(a[-1])
	for i in range(0,len(a)-1):
		c.append(a[i])
	a=c
	if c==b:
		hantei=True
		break
	else:
		hantei=False

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

list = list(s)
for i in range(len(list)):
  list.append(list[i])
  
list = "".join(list)
  
if S in list:
  print("Yes")
  
else:
  print("No")

Submission status: Accepted

Solution code:

S=input()
T=input()
flag=True
for i in range(len(S)):
    if S[i:]+S[:i]==T:
        print("Yes")
        flag=False
        break
if flag:
    print("No")

Submission status: Accepted

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

for i in range(len(s)):
    if (s[i:len(s)] + s[0:i]) == t:
        flag = True    

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

Submission status: Accepted

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

Submission status: Accepted

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

Solution code:
S = list(str(input()))
T = str(input())
s = len(S)
ss = " "
for x in S:
  ss+=x
flag = 0
for i in range(s):
  if ss == T:
    print("Yes")
    flag = 1
    break
  else:
    j = s-1
    while j > 0:
      S[j] , S[j-1] = S[j-1] , S[j]
      j-=1
    st =""
    for y in S:
      st+=y
    if st == T:
      print("Yes")
      flag = 1
      break
if flag == 0:
  print("No")

Submission status: Accepted

Solution code:
S = input()
S_length = len(S)
S_list = list(S)
T = input()
compare_S = ''

for _ in range(S_length):
    for i in range(S_length):
        compare_S+=S_list[i]
    if compare_S == T:
        print('Yes')
        exit()
    compare_S = ''
    pop_S_list = S_list.pop()
    S_list.insert(0, pop_S_list)
print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s=input();t=input()
flg=1
n=len(s)
for i in range(n):
    tmp = s[-i:]+s[:-i]
    if tmp == t:
        flg = 0
print("YNeos"[flg::2])

Submission status: Accepted

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

Submission status: Accepted

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

ans = 'No'
for i in range(len(s)):
    s = s[1:] + s[0]
    if s == t:
        ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
L = list(input())
T = input()
flag = 0
for i in range(len(L)) :
    L.append(L[0])
    L.pop(0)

    if T == "".join(L) :
        flag = 1
        break
if flag == 1 :
    print("Yes")
else :
    print("No")

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = ns()
t = ns()
ss = s+s

print('Yes') if t in ss else 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()
n = len(s)
for i in range(n):
    k = s[n-i-1:]+s[:n-i-1]
    if k == t:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print("Yes" if can_match else "No")

Submission status: Accepted

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

    for _ in range(len(s)):
        if s == t:
            print('Yes')
            break
        s = rotate(s)
    else:
        print('No')


def rotate(string):
    return string[1:] + string[0]


def model():
    s = input()
    t = input()
    # "abc" in "abcabc"
    if s in t * 2:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    # solve()
    model()

Submission status: Accepted

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

    for _ in range(len(s)):
        if s == t:
            print('Yes')
            break
        s = rotate(s)
    else:
        print('No')


def rotate(string):
    return string[1:] + string[0]


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

if k == len(S):
  print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
u = s + s
d = u.find(t)
if d == -1:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

print("No")

Submission status: Accepted

Solution code:
#後方一致文字数を探索
def count_substr(s1, s2):
    s2_length = len(s2)
    for i in range(s2_length):
        substr = s2[0:(s2_length - i)]
        if s1.endswith(substr):
            return (len(substr))
    return 0

#文字列を取得
s = input()
t = input()

#部分一致文字数を探索
match_count = count_substr(s, t)

is_match = False
#後方一致が見つかった場合
if match_count > 0:
    #文字列を回転
    slice  = len(s) - match_count
    s = s[slice:] + s[0:slice]
    is_match = (s == t)

#出力
print("Yes" if is_match else "No")

Submission status: Accepted

Solution code:
s = input()
t = input()
u = list(s)
v = list(t)
com1 = []
com1.append(u[0])

p = 0

for i in range(len(u)):
    for j in range(len(u)):
        if j == len(u) - 1:
            u[0] = com1[j]
        else:
            com1.append(u[j + 1])
            u[j + 1] = com1[j]

    if u == v:
        print("Yes")
        p = 1
        break
    com1 = []
    com1.append(u[0])

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

Submission status: Accepted

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

if s == t:
    print('Yes')
else:
    sCopy = s.copy()
    while sCopy != t:
        sCopy.insert(0, sCopy[-1])
        sCopy.pop(-1)
        if sCopy == t:
            res = 'Yes'
            break
        if sCopy == s:
            res = 'No'
            break
    print(res)

Submission status: Accepted

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

def main():
    s = S
    length = len(s)
    ans = "No"
    for _ in range(length):
        if s == T:
            ans = "Yes"
            break
        temp = s[-1] + s
        s = temp[0:length]
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(s)):
  s = s[-1]+s[0:len(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)):
  tmp=s[i:]+s[:i]
  if tmp==t:
    print('Yes')
    exit()
print('No')

Submission status: Accepted

Solution code:
from sys import stdin


def main() -> None:
    s = next_str()
    t = next_str()
    print(("No", "Yes")[s in t * 2])


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
T = input()
num = len(S)
C = ''
count = 0
if S == T:
    count += 1
    print('Yes')
else:
    for n in range(num):
        S = str(S[-1] + S[:num-1])
        if T == S:
            count += 1
            print('Yes')
            break

if count == 0:
    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:
a = raw_input()
b = raw_input()

l = len(a)
if a == b:
    print "Yes"
else:
    state = 0
    for i in range(l-1):
        a = a[-1]+a[0:-1]
        if a == b:
            print "Yes"
            state = 1
            break
    if state == 0:
        print "No"

Submission status: Accepted

Solution code:
A = list(input())
B = list(input())
length = len(A)
for i in range(length):
 if  A == B:
  print('Yes')
  break
 A = list(A[-1])+A[:-1]
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
for _ in range(len(S)):
    S = S[1:] + S[0]
    if S == T:
        print('Yes')
        exit()

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = list(str(input()))
T = list(str(input()))
for let in S:
    last = S.pop(-1)
    S.insert(0,last)
    if S==T:
        print("Yes")
        exit()
    else:
        pass
print("No")

Submission status: Accepted

Solution code:
def rotation(s, t):
    l = len(s)
    j = 0
    while True:
        jj = True
        for i in range(len(s)):
            if s[(i + j) % l] != t[i]:
                jj = False
                break
        if jj:
            return 'Yes'
        j += 1
        if j == l:
            break
    return 'No'

s = input()
t = input()

print(rotation(s, t))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# a, b = (map(int, input().split()))
str_a = input()
str_b = input()

for i in range(len(str_a)):
    if str_a == str_b:
        print('Yes')
        exit()
    b = str_a[-1]
    c = str_a[:-1]
    str_a = b + c

print('No')

Submission status: Accepted

Solution code:
import sys
s = list(input())
t = list(input())
n = len(s)
r = ['']*n

for i in range(n):
    r[0] = s[n - 1]
    for j in range(1, n):
        r[j] = s[j - 1]
    s = r
    r = ['']*n
    if s == t:
        print('Yes')
        sys.exit()

print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s=list(input())
t=list(input())

n=len(s)
same=False
for i in range(0,n):
  if s==t:
    same=True
    break
  t=t[1:]+t[:1]
  

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
S = len(list(s))
ans = 'No'

for i in range(S+1):
    if s == t:
        ans = 'Yes'
        break
    else:
        d = s[:S-1]
        e = s[-1]
        s = e+d

print(ans)

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 = list(s[-1]) + s[:-1]

print(ans)

Submission status: Accepted

Solution code:
# String Rotation
s = list(input())
t = list(input())
s_ = s
for i in s:
    if s_ != t:
        s_ += s[0]
        del s_[0]
    else:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
S = [s for s in input()]
T = [t for t in input()]

for _ in range(len(S)):
  a = S.pop(-1)
  S.insert(0, a)

  if S == T:
    break
    
if S == T:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
for _ in T:
    if S == T:
        print("Yes")
        exit(0)
    c = T.pop(0)
    T.append(c)
print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
ans = 'No'
if s == t:
    ans = 'Yes'

cnt = 0
while s != t:
    cnt += 1
    s = [s[-1]] + s[:-1]
    if s == t:
        ans = 'Yes'
    
    if cnt > len(s):
        break

print(ans)

Submission status: Accepted

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

flag = 0

for i in range(len(s)):
    flag = 0
    for j in range(len(s)):
        if s[j] != t[(j + i) % len(s)]:
            flag = 1

    if flag == 0:
        print("Yes")
        exit(0)
        

print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = str(input())
t = str(input())
s_list = []
t_list = list(t)
n = 0
#print(t_list)
while n < len(s):
    for i in range(0,len(s)):
        if n+i < len(s):
            s_list.append(s[n+i])
        else:
            s_list.append(s[n+i-len(s)])
    if t_list == s_list:
        print("Yes")
        break
    s_list = []
    n += 1
else:
    print("No")

Submission status: Accepted

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

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

if slen != tlen:
    print("No")

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

if s != t:
    print("No")

Submission status: Accepted

Solution code:

S = input()
T = input()

N = len(S)

tmp = S


isOk = False
for i in range(N):
    if tmp == T:
        isOk = True
        break
    tmp = tmp[1:] + tmp[0]

if tmp == T:
    isOk = True

if isOk:
    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:]+S[:i] == T:
        ans = 'Yes'
        
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
c=0
for i in range(len(s)):
  u=[s[j] for j in range(i,len(s))]
  if i>0:
    for k in range(0,i):
      u.append(s[k])
  if t==u:
    c=1
    break
if c==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')
        exit()
    s = s[-1] + s[:-1]
print('No')

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

Solution code:
"""
B - String Rotation
愚直に変換してチェックする
"""

s = input()
test = input()

for i in range(len(s)):
    s_right = s[i:]
    s_left = s[:i]

    s_rot = s_right + s_left
    
    #print(s_rot)

    if s_rot == test:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - String Rotation
https://beta.atcoder.jp/contests/abc103/tasks/abc103_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(s, t):
    for _ in range(len(s)):
        if s == t:
            return 'Yes'
        s = s[1:] + s[0]
    return 'No'


def main(args):
    s = input().strip()
    t = input().strip()
    ans = solve(s, t)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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")