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 = str(input())
T = str(input())
n = len(S)
for i in range(n):
    S_ = S
    S_ = S_[i:]+S_[0:i]
    if S_ == T:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
b = input()
a *= 2
for i in a:
    if b in a:
        print("Yes")
        break
else:
    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")
		break
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

s = [_ for _ in input()]
t = [_ for _ in 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()
s=list(S)
T=input()
t=list(T)
for i in range(len(s)):
  s.insert(0,s[-1])
  s.pop(-1)
  if s==t:
    print('Yes')
    exit()
  
print('No')

Submission status: Accepted

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

def change(s):
    u=str()
    for i in range(len(s)):
        if i==0:
            u+=s[len(s)-1]
        else:
         u+=s[i-1]
    return u

flag=False

if(s==t): 
    flag=True

for i in range(len(s)-1):
    s=change(s)
    #print(s)
    if(s==t):
        flag=True
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

s=input()
t=input()

for i in range(len(s)):
    u=""
    for j in range(len(s)):
        u+=s[j-i]
#    print(u)
    if(u==t):
        print("Yes")
        exit()
    
print("No")

#print(s[0])
#print(t[0])

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

Solution code:
arr = []
S = str(input())
T = str(input())
C = ""

for i1 in range(0, len(S)):
  for i2 in range(1, len(S)):
    C=C+S[i2]
  C=C+S[0]
  arr.append(C)
  S=C
  C=""

if T in arr:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial#, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    s = s_input()
    t = s_input()

    len_s = len(s)

    sl = list(s)

    for i in range(len_s):
        tmp = ''.join(sl)
        if tmp == t:
            Yes()
            exit()
        sl.append(sl[0])
        sl = sl[1:]
    No()

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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)]


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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

if (S+S).count(T)>=1:
    print ('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
time = 0
if s == t:
	print("Yes")
while s != t:
	tmp = s[-1]
	s = tmp + s
	s = s[:-1]
	time += 1
	if s == t:
		print("Yes")
		break
	if time >= len(s):
		print("No")
		break

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

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

	for i in range(len(s)*3):
		if s == t:
			print('Yes')
			return
		s = s[-1] + s[:-1]
	print('No')
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
L=[s]
for i in range(1,len(s)):
    k=s[-i:]+s[:-i]
    L.append(k)
print('Yes' if input() in L else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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


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

print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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)):
    s = S[i:] + S[:i]
    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):
  if t == s[i:]+s[:i]:
    print("Yes")
    exit()
else:
  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:
s=input()
t=input()
ans=0
for i in range(len(s)):
    s=s[1:]+s[0]
    if s==t:
        ans+=1
if ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import os

s = list(map(str,input()))
t = list(map(str,input()))
s = s*2
n = len(t)

for i in range(n):
    flag = True
    for j in range(n):
        if s[i+j]!=t[j]:
            flag = False
            break
    if flag:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    S = input()
    T = input()
    ans = False
    for i in range(len(S)):
        if T == S[i:] + S[:i]:
            ans = True
            break
    print('Yes' if ans else 'No')
if __name__ == '__main__':
    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()

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

print('No')

Submission status: Accepted

Solution code:
from collections import deque
S = deque(input())
T = deque(input())
for _ in range(len(S)):
    S.rotate()
    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()
  s = s[1:] + s[0]
print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
for i in range(len(S)):
    T_ = S[i:] + S[:i]

    if T == T_:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
S=input()
T=input()
s=[]
t=[]
for i in S:
    s.append(i)
for i in T:
    t.append(i)
count=0
for i in range(len(s)):
    s_last=s[-1]
    s.insert(0,s_last)
    del s[-1]
    #print(s)
    #print(t)
    for p in range(len(s)):
        if s[p]==t[p]:
            count+=1
    #print(count)
    if count==len(s):
        print("Yes")
        sys.exit()
    else:
        count=0
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S =input()
T =input()
#print(S)
s = len(S)-1
S = list(S)

#print(S)
flag = 0
for i in range(len(S)):
    h = [S[0]]
    S.remove(S[0])
    S = S + h
    str_ = ''.join(S)
    #print(str_)
    if str_ == T:
        flag = 1
        break
    #print(S)

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect
import re

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

def main():
    s = input()
    t = input()
    if solve(s, t):
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = str(input())
t = str(input())
ans = "No"

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=input()
t=input()
n=len(s)
s=list(s)
for i in range(n):
  fs=s.pop()
  s=[fs]+s
  t_str=""
  for ss in s:
    t_str+=ss
  if t_str==t:
    print("Yes")
    exit(0)
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()]

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

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    S = input()
    T = input()

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    S=input()
    T=input()
    for i in range(len(S)):
        S=S[-1]+S[:-1]
        if S==T:
            print("Yes")
            break
    else:print("No")
#%%submit!
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc103/tasks/abc103_b
S = input()
T = input()
S = S + S
print('Yes' if S.count(T) else 'No')

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
s = list(input())[:-1]
t = list(input())[:-1]
n = len(s)
fflag = 0
for i in range(n):
    if fflag == 1:
        break
    flag = 0
    for j in range(n):
        index = (i+j)%n
        if s[index] != t[j]:
            flag = 1
            break
    if flag == 0:
        print("Yes")
        fflag = 1
if fflag == 0:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

s=deque(input())
t=deque(input())
for i in range(len(t)):
    s.appendleft(s[-1])
    s.pop()

    if s==t:

        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = list(input())
t = list(input())
n = len(s)
for i in range(n):
    tmp = [s[-1]] + s[:n-1]
    s = tmp[::]
    if s == t:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(s)):
    temp = s.pop(0)
    s += temp
    if s == t:
        print("Yes")
        exit()
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

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

Submission status: Accepted

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

Submission status: Accepted

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

l=len(S)
out=["No","Yes"]
flg=0

for i in range(l):
    if T==S[l-i-1:]+S[0:l-i-1]:
        flg=1
        break

print(out[flg])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import string
import collections
from collections import Counter


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

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

Submission status: Accepted

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

print(ans)

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 = list(input())
t = input()
ans = "No"
for i in range(len(s)):
    s.append(s.pop(0))
    if "".join(s)==t:
        ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import deque

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = list(input())
    t = list(input())
    que = deque(t)
    n = len(s)

    for i in range(n):
        if s == list(que):
            print("Yes")
            break
        a = que.popleft()
        que.append(a)
    else:
        print("No")


if __name__ == '__main__':
    resolve()

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]
print("No")

Submission status: Accepted

Solution code:
def main():
    from collections import deque
    S = deque([s for s in input()])
    T = deque([s for s in input()])
    N = len(S)
    for _ in range(N):
        if S == T:
            return print("Yes")
        S.rotate()
    print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

S = list(input())
T = list(input())

N = len(S)
for i in range(N): #スタート位置
    flag = True
    for j in range(N):
        if S[(i + j) % N] == T[j]:
            continue
        flag = False
        break
    if flag:
        print ('Yes')
        exit()

print ('No')

Submission status: Accepted

Solution code:
def examA():
    S = SI()
    T = SI()
    N = len(S)
    ans = "No"
    for i in range(N):
        cur = S[i:] + S[:i]
        #print(cur)
        if cur==T:
            ans = "Yes"
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check():
    S = input()
    T = input()
    S *= 2
    if T in S:
        return 'Yes'
    return 'No'
print(check())

Submission status: Accepted

Solution code:
def resolve():
  s = input()
  t = input()
  s += s
  if t in s:
    print("Yes")
  else:
    print("No")
  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

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

for i in range(len(s)+1):
  s=s[1:]+s[0]
  if s==t:
    print('Yes')
    exit()
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:
def main():
    s = input()
    t = input()
    for _ in range(len(s)):
        s = s[-1] + s[:-1]
        if s == t:
            print("Yes")
            break
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 16:40:33 2020

@author: shinba
"""
from collections import deque

s = deque(input())
t = deque(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=str(input())
t=str(input())
s=list(s)+list(s)
t=list(t)
ans=0
for i in range(0,len(t)):
  count=0
  for j in range(0,len(t)):
    if s[i+j]==t[j]:
      count=count+1
  if count==len(t):
    ans=1
if ans==1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

S = deque(input())
T = deque(input())

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

Submission status: Accepted

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

ans = "No"

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

print(ans)