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 = input()
B = input()
x = 0
for i in range(len(A)):
    A = A[-1] + A[:len(A)-1]
    if A==B:x=1
if x==0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

def check(S, T) :
    for _ in range(len(S)) :
        if S == T :
            return 'Yes'
        else :
            t = T.pop()
            T = [t] + T
    return 'No'
    
print(check(S, T))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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()
N = len(S)
for i in range(N):
    S = S[N-1] + S[:N-1]
    if S == T:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
s,t=list(input()),list(input())
n=len(s)
num=0
ans_t=[]
if s[0]==t[-1] and s[1]==t[0]:
    ans_t=s[1:]+[s[0]]
else:
    for j in range(n-1):
        if s[0]==t[j] and s[1]==t[j+1]:
            num=j
            for i in range(num):
                ans_t.append(s[n-num+i])
            for i in range(n-num):
                ans_t.append(s[i])
print('Yes' if t==ans_t or s==t else 'No')

Submission status: Accepted

Solution code:
S = list(input())
T = input()
for i in range(len(S)+1):
  tmp = S.copy()
  tmp1 = tmp[:i]
  del tmp[:i]
  tmp.extend(tmp1)
  if "".join(tmp) ==T:
    print('Yes')
    break
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:
def main():
  s=input()
  t=input()
  if s==t:
    print("Yes")
    return
  for i in range(1,len(s)):
    if s==t[i:]+t[:i]:
      print("Yes")
      return
  print("No")
main()

Submission status: Accepted

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

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


if s != T:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

ans = False
for i in range(len(s)):
    rotated_s = ""
    if i == 0:
        rotated_s = s[i:-1] + s[-1]
    else:
        rotated_s = s[i:-1]+ s[-1] + s[0:i]
    
    if rotated_s == t:
        ans = True

if ans is True:
    print("Yes")
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:
# coding: utf-8
s1 = list(input().strip())
s2 = input()

for i in range(len(s2)):
    if "".join(s1) == s2:
        print("Yes")
        exit()
    tmp = s1.pop(0)
    s1.append(tmp)

print("No")

Submission status: Accepted

Solution code:
import copy
s = list(str(input()))
t = list(str(input()))
#print(s)

bool =True
cnt =0
while bool:
    S =s.copy()
    for i in range(len(s)):
        if i == 0:
            s[0]=S[-1]
        else:
            s[i]=S[i-1]
    #print(s)
    if s==t:
        print('Yes')
        exit()
    cnt +=1
    if cnt == len(s):
        bool =False
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def count_diff(a,b):
    """
    コードを単純化
    """
    cnt = 0
    for c in a:
        if not(c in b):
            return True
    for c in b:
        if not(c in a):
            return True
    return False

def main():
    S = str(input())
    T = str(input())

    if(S==T):
        print('Yes')
        return
    if(count_diff(S,T)):
        print('No')
        return
    
    #操作の時間
    length_S = len(S)
    ch_S = S
    for i in range(length_S):
        ch_S = ch_S[length_S-1] + ch_S[0:length_S-1]
        if(ch_S == T):
            print('Yes')
            return
    print('No')



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()
T = input()
ans = False
for i in range(len(S)):
    rotate = S[i:] + S[:i]
    if T == rotate:
        ans = True
if ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=list(input())
t=input()
for i in range(len(s)):
    s.insert(0,s.pop())
    word="".join(s)
    if word==t:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
from collections import deque
s=list(input())
s=deque(s)
t=input()
for i in range(len(s)):
    s.appendleft(s.pop())
    if t=="".join(s):
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
s=list(input())
t=input()
for i in range(len(s)):
    s.insert(0,s.pop(-1))
    word="".join(s)
    if word==t:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


s = deque(S())
t = deque(S())
n = len(s)
for i in range(n):
    s.appendleft(s.pop())
    if s == t:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
ans = False
if S == T:
    ans = True
for i in range(1, len(S)):
    if S[i:]+S[:i] == T:
        ans = True

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

Submission status: Accepted

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

rot_list = []
for _ in S:
    S = S[-1] + S[: -1]
    rot_list.append(S)


if T in rot_list:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    t = str(input().rstrip('\n'))
    cnt = 0
    while True:
        if s == t:
            print("Yes")
            exit()
        elif cnt > len(s):
            print("No")
            exit()
        else:
            s = s[-1] + s[:-1]
            cnt += 1


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def next(strings):
    return strings[1:] + strings[0]


S = input()
T = input()
for i in range(len(S)+1):
    if S == T:
        print('Yes')
        exit()
    S = next(S)
print('No')

Submission status: Accepted

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

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

else:
    for i in range(1, len(s)):
        tmp = "".join(s[i::]) + "".join(s[:i:])
        if tmp == t:
            print("Yes")
            exit()

        if i == len(s) - 1:
            print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
import sys
S = deque(list(input()))
T = list(input())
for i in range(len(S)):
    s = S.pop()
    S.appendleft(s)
    if list(S) == T:
        print("Yes")
        sys.exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

u = ''
ans = 'No'

for i in range(len(t)):
  u = t[i:]+t[:i]
  if s==u:
    ans = 'Yes'
    break

print(ans)

Submission status: Accepted

Solution code:
s1 = input()
s2 = input()
n = 0

while n <= len(s1):
    s1 = s1[-1]+s1[:-1]
    #print(s1[-1],s1[:-1],s1)
    if s1 == s2:
        print("Yes")
        exit()
    n += 1
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

def resolve():
  s = input()
  t = input()

  l = len(s)

  ss = s + s

  for i in range(l):
    if t == ss[i:i+l]:
      print('Yes')
      return

  print('No')


if __name__ == "__main__":
  resolve()

Submission status: Accepted

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

Submission status: Accepted

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

b = False
for i in range(len(s)):
    if s == t:
        b = True
    s = s[len(s)-1] + s[0:len(s)-1]

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input();t=input()
c=0
for i in range(len(s)):
    if s==t:
        c+=1
        break
    t=t[-1]+t[:-1]
print('YNeos'[c<1::2])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()
t = input()
s_check = s + s[0:-1]
if t in s_check:
    print("Yes")
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")
        break
else:
    print("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=list(input())
t=list(input())
flag=0
for i in range(0,len(s)):
    if s==t:
        flag=+1
        break
    else:
        s.insert(0,s.pop())
if len(s)==2:
    if s==t:
        flag=+1
    else:
        s.insert(0,s.pop())
        if s == t:
            flag = +1
if flag>0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S,T=input(),input()
N=len(S)
U=[]

for i in range(N):
  S=S[-1]+S[:-1]
  U.append(S)
#print(U)

print("Yes" if U.count(T)>0 else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
S=input()
T=input()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ABC103b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

s = input()[:-1]
t = input()[:-1]

tt = t

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

Submission status: Accepted

Solution code:
# ABC103B - String Rotation
def main():
    S, T = open(0).read().split()
    N = len(S)
    for i in range(N):
        if S[i:] + S[:i] == T:
            print("Yes")
            return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S=list(input())
S+=S
T=list(input())
N=len(T)
for i in range(N):
  if S[i:i+N]==T:
    print("Yes")
    exit()
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:
s = str(input())
t = str(input())
n = len(s)
for i in range(n):
    a = s[:i]
    b = s[i:]
    c = b+a
    if c == t:
        print("Yes")
        exit()
    else:
        continue

print("No")

Submission status: Accepted

Solution code:




def main():

    S = list(input())
    T = list(input())
    for i in range(len(S)):
        if S==T: print('Yes');exit()
        S.insert(0,S.pop(-1))
    print('No')





if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S_input = input()
T_input= input()

S = [str(i) for i in S_input]
T = [str(i) for i in T_input]

flag = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()

n = len(s)

for i in range(n):
  if s[i:] + s[:i] == t:
    print("Yes")
    sys.exit()

print("No")

Submission status: Accepted

Solution code:
import sys
s = list(input())
t = list(input())
if s == t:
    print('Yes')
    sys.exit()
for si in range(len(s)+1):
    before = s[:si+1]
    after = s[si+1:]
    if after + before == t:
        print('Yes')
        sys.exit()
print('No')

Submission status: Accepted

Solution code:
import sys
s = list(input())
t = list(input())
if s == t:
    print('Yes')
    sys.exit()
for si in range(len(s)+1):
    before = s[0:si+1]
    after = s[si+1:len(s)+1]
    if after + before == t:
        print('Yes')
        sys.exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def same_string(a, b, start):
  if len(a) != len(b):
    return False
  
  for i in range(len(a)):
    if a[i] != b[start]:
      return False
    start = (start + 1) % len(b)
  return True


def can_rotate(a, b):
  for i in range(len(b)):
    if same_string(a, b, i):
      return True
  return False


a = input()
b = input()
print("Yes" if can_rotate(a, b) else "No")

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()

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

print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
s = deque(list(input()))
t = input()
for i in range(len(s)):
    if ''.join(s) == t:
        print('Yes')
        exit()
    else:
        c = s.pop()
        s.appendleft(c)
print('No')

Submission status: Accepted

Solution code:
from collections import Counter
s = input()
t = input()


s_pattern = Counter(s)
t_pattern = Counter(t)


def check(string, original):
    n = len(string)
    flag = False
    for i in range(n):
        if original == string[i:] + s[:i]:
            flag = True
            break
    return flag


if s_pattern != t_pattern:
    print('No')
else:
    if check(s, t):
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
N = len(S)
f = False
for i in range(N):
  if T == S[i:]+S[:i]:
    f = True
if f:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

s1 = s + s
count = [0] * len(s)

for i in range(len(s)):
    for j in range(len(s)):
        if s1[i + j] == t[j]:
            count[i] += 1

print("Yes" if max(count) == len(s) else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
for e in s:
    if s[-1]+s[0:-1] == t:
        print("Yes")
        exit()
    else:
        s = s[-1]+s[0:-1]
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
t=input()
ans=[]
for i in range(len(s)):
    s.insert(0,s.pop(-1))
    ans.append("".join(s))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

s=deque(input())
t=deque(input())
for i in range(len(s)):
  s1=s.popleft()
  s.append(s1)
  if s==t:
    print('Yes')
    exit()
print('No')

Submission status: Accepted

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

flag = 0
if S == T:
    flag = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

ans ="No"
S=deque(input())
T=deque(input())
for i in range(len(S)):
    S.rotate()
    if S == T:
        ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:

S = input()
A = input()
flag = 0
for i in range(len(S)):
    A_new = A[i:] + A[:i]
    if A_new == S:
        flag = 1
        break

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

Submission status: Accepted

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

for i in range(len(S)):
    s = S[-i:] + S[:-i]
    if s == T:
        print('Yes')
        break
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:
a, b= list(input()),input()
for _ in range(len(a)):
    if b in "".join(a):
        print("Yes")
        break
    a.insert(0,a.pop())
else: print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(S)):
    if T == S:
        print("Yes")
        exit()
    else:
        t = S.pop(0)
        S.append(t)

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

print("No")

Submission status: Accepted

Solution code:
s = input()
t = 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=str(input())
t=str(input())

for _ 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()
t = input()
for _ 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()*2
t = input()
print('Yes' if t in s else '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:
        tmp = S[0]
        S = S[1:]
        S = S + tmp
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")
    break
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
ans = "No"
for i in range(len(S)):
  S_rotation = ""
  for j in range(i, len(S)+i):
    S_rotation += S[j%len(S)]
  if S_rotation == T:
    ans='Yes'
print(ans)

Submission status: Accepted

Solution code:
# ABC103 B-StringRotation
S = [s for s in input()]
T = input()
S_ = []
S_Jugde = ""

for i in range(len(S)):
    S_ = S[:]
    for j in range(len(S)-1):
        if j == 0:
            S[0] = S_[len(S)-1]
        S[j+1] = S_[j]

        if j == len(S)-2:
            S_Jugde = "".join(S)
            if S_Jugde == T:
                print("Yes")
                exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(S)):
    temp = S[-1]
    S.pop()
    S.insert(0, temp)
    if str(S) == str(T):
        Flag = True

if Flag:
    print("Yes")
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 = list(input())
t = list(input())

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

print("No")

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = raw_input()
T = raw_input()
list_S = list(S)
list_T = list(T)
ans = False
for i in range(len(list_T)):
        if list_S == list_T:
                ans = True
                break
        X = list_T.pop(0)
        list_T.append(X)
if ans:
        print "Yes"
else:
        print "No"

Submission status: Accepted

Solution code:
from collections import deque
S = input()
T = input()
S = deque(S)
T = deque(T)
for _ in range(len(S)):
    if S == T:
        print('Yes')
        exit()
    S.appendleft(S.pop())
print('No')

Submission status: Accepted

Solution code:
import sys
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

s = input()
t = input()
ans = "No"
s = deque(s)
for i in range(len(s)):
    if list(s) == list(t):
        ans = "Yes"
        break
    s.appendleft(s.pop())
print(ans)

Submission status: Accepted

Solution code:
s,t = [input() for _ in range(2)]
for _ in range(len(s)):
    if s==t:
        print("Yes")
        break
    s = s[1:]+s[0]
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")
    break
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S, T = (input() for _ in range(2))
rot = False
for _ in range(len(S)):
    if S == T:
        rot = True
        break
    S = S[-1] + S[0:-1]
print('Yes' if rot == True else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = 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 = input() * 2
T = input()

if T in S:
    print("Yes")
else:
    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:
def is_anargam(s, t):
    if sorted(s.lower()) == sorted(t.lower()):
        return True
    else:
        return False


def string_rotate(s, t):
    """
    check if strings equal after roatation
    """
    if s==t:
        return True

    if not is_anargam(s, t):
        return False

    idx = s.index(t[0])
    f_part = s[idx:]
    l_part = s[:idx]

    if f_part + l_part == t:
        return True
    else:
        return False


s = raw_input()
t = raw_input()

if string_rotate(s, t):
    print "Yes"
else:
    print "No"

Submission status: Accepted

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

Submission status: Accepted

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

S = input()
T = input()

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

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

Solution code:
s,t=open(0);print(" YNeos"[t[:-1]in[s[i:-1]+s[:i]for i in range(99)]::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = input()
B = input()
for i in range(len(A)):
    if A == B:
        print("Yes")
        exit()
    A = (A+A[0])[1:]
print("No")