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:
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

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

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

mod = 1000000007

"""
# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    S = sys.stdin.readline().rstrip()
    T = sys.stdin.readline().rstrip()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = input()
n = len(s)
f = False
for i in range(n):
    tmp = s[n-1]
    for j in range(n-1,-1,-1):
        s[j] = s[j-1]
    s[0] = tmp
    if t == "".join(s):
        print("Yes")
        f = True
        break
if not f:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    T = input()
    if len(S) != len(T):
        return "No"
    for i in range(len(S)):
        if S[i] == T[0] and S[i:] + S[:i] == T:
            return "Yes"
    return "No"

if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from collections import deque
import copy

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = inputs[0]
    T = inputs[1]

    string_queue = deque(S)
    T_queue = deque(T)

    for i in range(len(S)):
        if string_queue == T_queue:
            return 'Yes'
        p = string_queue.pop()
        string_queue.appendleft(p)
    return 'No'


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)

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

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

Submission status: Accepted

Solution code:
s, t = [input() for _ in range(2)]
if t in s*2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    s = list(input())
    t = list(input())

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

Submission status: Accepted

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

for i in range(n):
    p = s.pop(-1)
    s.insert(0, p)
    if s == t:
        print('Yes')
        break
    else:
        continue
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

from collections import deque

S, T = input(), input()
S_q, T_q = deque(list(S)), deque(list(T))
tmp = ""

for i in range(len(S)):
    if S_q == T_q:
        print("Yes")
        exit()
    else:
        tmp = S_q.pop()
        S_q.appendleft(tmp)
else:
    print("No")

Submission status: Accepted

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

for i in range(len(S)):
    S_temp=S[len(S)-1]
    for j in range(len(S) - 1, 0, -1):
        S[j]=S[j-1]
    S[0]=S_temp
    if "".join(S)=="".join(T):
        print("Yes")
        exit()

print("No")

Submission status: Accepted

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

for i in range(N):
    cnt = 0
    for j in range(N):
        if S[j] != T[(j+i) % N]:
            break
        cnt += 1
    if cnt == N:
        break
if cnt == N:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
sin = [i for i in input()]
tin = [i for i in input()]
s = deque(sin)
s_origin = deque(sin)
t = deque(tin)
s.rotate(1)
while s!=s_origin:
    if s == t or s_origin == t:
        print("Yes")
        break
    s.rotate(1)
else:
    if s_origin == t:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(N):
    R = S.copy()

    for j in range(N):
        if j == N-1:
            S[0] = R[N-1]
        else:
            S[j+1] = R[j]

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

print("No")

Submission status: Accepted

Solution code:
s=input()
t=input()
t=t+t
if s in t:
  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()
    else:
        l=[]
        l=[s for s in S]
        l.append(l.pop(0))
        S=''.join(l)
print('No')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

A = list(input().strip())
B = list(input().strip())

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

print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
x = ""
if s==t:
  print('Yes')
else:
  for i in range(len(s)):
    if i!=len(s)-1:
      if s[i]==t[0] and s[i+1]==t[1]:
        for j in range(i,len(s)):
          x += s[j]
        for k in range(i):
          x += s[k]
    elif i==len(s)-1:
      if s[i]==t[0] and s[0]==t[1]:
        for j in range(i,len(s)):
          x += s[j]
        for l in range(i):
          x += s[l]
  print('Yes' if x==t else 'No')

Submission status: Accepted

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


if __name__ == "__main__":
    print(solve())

Submission status: Accepted

Solution code:
S = input()
T = input()
print('YNeos'[T not in (S+S)::2])

Submission status: Accepted

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

ss = s + s

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

Submission status: Accepted

Solution code:
S = [i for i in input()]
T = [j for j in input()] 

x = sorted(S)
y = sorted(T)
i = 0

if x == y:
  while i <= len(S):
    O = S.copy()
    S.pop()
    S.insert(0,O[-1])
    i += 1
    if S == T:
      print("Yes")
      break
  else:
    print("No")
else:
  print("No")

Submission status: Accepted

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

for i in range(len(s)):
    a = s[-1]
    s.pop(-1)
    s.insert(0,a)
    a = []
    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)):
  x=s.pop(0)
  s.append(x)
  if s==t:
    print("Yes")
    break
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
cnt = 0
while True:
    if cnt >= 100:
        print("No")
        exit()
    elif s == t:
        print("Yes")
        exit()
    else:
        s = s[-1] + s[:-1]
        cnt += 1

Submission status: Accepted

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

SS = S*2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def rotate(word , n):
    return word[n:len(word)] + word[:n]

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

    for i in range(len(S)):
        if rotate(S,i) == T:
            print('Yes')
            exit()

    print('No')

main()

Submission status: Accepted

Solution code:
s, t = [input() for _ in range(2)]
if s in t * 2:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
ans = 'No'
if s == t:
    ans = 'Yes'
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()

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

Submission status: Accepted

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

Submission status: Accepted

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


if S == T :
    ans = "Yes"
else:
    list_S =list(S) 
    list_T =list(T) 
    L = list_S
    L  =  tuple(L)
    ans = "No"
    #i:移動距離
    for i in range(1,len(S)+1):
        #移動
        for j in range(len(S)):
            list_S[j] = L[-i+j]
        if list_S == list_T :
            ans = "Yes"
            break
print(ans)

Submission status: Accepted

Solution code:
import math
import copy
import sys

def rotation(s):
    rot = []
    for i in range(1, len(s)):
        rot.append(s[i])

    rot.append(s[0])

    return rot

inputa = input().split()
inputb = input().split()
# inputc = input().split()

# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

# inputaList = [int(n) for n in inputa]

# inputb = input().split()
# inputbList = [int(n) for n in inputb]
#
# inputList = []
# inputNumList = []
# for i in range(a):
#     inputNum = input()
#     inputNumList = list(inputNum)
#     inputList.append(inputNumList)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

a = str(inputa[0])
inputaList = list(a)

b = str(inputb[0])
inputbList = list(b)

tmpinput = []
tmpinput = copy.deepcopy(inputaList)
tmp = []

for i in range(len(inputaList)):
    tmpinput = copy.deepcopy(rotation(tmpinput))

    flg = True
    for j in range(len(inputaList)):
        if tmpinput[j] != inputbList[j]:
            flg = False

    if flg:
        print("Yes")
        break

if flg == False:
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
yes = False
for a in range(0, len(s)):
    if (s == t):
        print('Yes')
        yes = True
        break
    s = s[1:] + s[:1]
if (not yes):
    print('No')

Submission status: Accepted

Solution code:
import os, sys, re, math

lines = sys.stdin.readlines()

s = lines[0].strip()
t = lines[1].strip()

if t in (s + s) and s in (t + t):
    print ('Yes')
else:
    print ('No')

Submission status: Accepted

Solution code:
s = raw_input()
t = raw_input()
ss = s + s
tt = t + t
if t in ss and s in tt:
    print 'Yes'
else:
    print 'No'

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
b = input()
correct = False
for i in range(len(a)):
    if a[i:] + a[:i] == b:
        correct = True
print('Yes' if correct else 'No')

Submission status: Accepted

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

def rolling(str , n):
    return str[n:len(str)] + str[:n]

for i in range(len(s)):
    if rolling(s, i) == t:
        count += 1
if count == 0:
    print('No')
else:
    print('Yes')

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)):
    s2 = s[i:] + s[:i]
    if s2 == 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:
print("Yes" if input() in input()*2 else "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:
import sys
S = list(input())
T = str(input())

for i in range(len(S)):
	mojiretsu = ''.join(S)
	if T == mojiretsu :
		print('Yes')
		sys.exit()
	else:
		#リストの入れ替えを行う
		target = S[-1]
		S.pop(-1)
		S.insert(0,target)

print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
y = 0
def rolling(str, n):
    return str[n:len(str)] + str[:n]
for x in range(len(t)):
    if s == rolling(t, x):
        y = 1
if y == 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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,t=input(),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()

flag=False
for _ in range(len(S)):
  S = list(S)
  temp = S.pop()
  S = "".join([temp]+S)
  if S==T:
    flag=True
    break
if flag:
	print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
 
a = 'No'

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

Submission status: Accepted

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

S += S
flag = False

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

ans = 'Yes' if flag == True else 'No'
print(ans)

Submission status: Accepted

Solution code:
S = input()
T = input()
cnt = 0
s = S + S
ans = False
if S == T:
    ans = True
else:
    for i in range(len(S)):
        if s[i]==T[0]:
            for j in range(len(T)):
                if s[i+j]==T[j]:
                    cnt +=1
            if cnt%len(T)==0:
                ans = True
            cnt = 0
if ans == True:
    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')
        exit()
    s.append(s[0])
    s.pop(0)

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
  s = s[::-1]
  s = s.replace(s[0],'',1)
  s = s[::-1]
print('No')

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

s = input().strip()
t = input().strip()

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

Submission status: Accepted

Solution code:
S = input()
T = input()
cnt = 0
s = S + S
ans=False
if S==T:
  ans=True
else:
  for i in range(len(S)):
    if s[i]==T[0]:
        for j in range(len(T)):
            if s[i+j]==T[j]:
                cnt +=1
        if (cnt%len(T))==0:
          ans=True
        cnt=0
          
if ans==True:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC103-B
S = list(input())
T = list(input())
l = len(S)
ans = "No"
for i in range(l):
    if S == T:
        ans = "Yes"
        break
    S.insert(0, S[len(S) - 1])
    S.pop()
print(ans)

Submission status: Accepted

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

flag = False

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

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

Submission status: Accepted

Solution code:
s1 = list(input())

s2 = list(input())

ans = 'No'

for i in range(len(s1)):
  if ("".join(s1) == "".join(s2)):
    ans = 'Yes'
    break  
  last = s1.pop()
  s1.insert(0,last)
print(ans)

Submission status: Accepted

Solution code:

a = input()
b = input()
s = 0 
for i in range(len(a)):
    b = b[-1] + b[:-1]
    if a == b:
        s = 1
def Y(a,t = 0):
    if a==t : print('YES')
    else : print('NO')
def y(a, t =0):
    if a==t : print('Yes')
    else : print('No')
y(s,1)

Submission status: Accepted

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

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

print(ans)

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)

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

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


def main():
    S = INPUT()
    T = INPUT()
    N = len(S)

    for i in range(N):
        if S == T:
            print('Yes')
            sys.exit(0)
        else:
            S = S[N-1] + S[:N-1]

    print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

for _ in range(len(S)):
    if S == T:
        print("Yes")
        sys.exit()
    else:
        S.insert(0, S[-1])
        S.pop(-1)

print("No")

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
s = input()
t = input()
s2 = s
while True:
    s2 = s2[-1] + s2[:-1]
    if s2 == t:
        print("Yes")
        exit()
    elif s2 == s:
        print("No")
        exit()

Submission status: Accepted

Solution code:
S = input()
T = input()
s = []
t = []
n = len(S)
for i in range(n):
  s.append(S[i])
  t.append(T[i])
for i in range(n):
  if s == t:
    print('Yes')
    break
  zero = s[0]
  del s[0]
  s.append(zero)
else:
  print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(len(S)):
  if S[i:]+S[:i]==T:
    f = True

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

Submission status: Accepted

Solution code:
S = input()
T = input()
L = len(S)
f = False

for i in range(L):
  if S[i:]==T[:L-i] and S[:i]==T[L-i:]:
    f = True

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

Submission status: Accepted

Solution code:
import sys
S = input()
T = input()
if len(S)!=len(T):
    print('No')
    sys.exit()
S = S+S
for i in range(len(T)):
    flag = True
    for j in range(len(T)):
        if S[i+j] != T[j]:
            flag = False
    if flag:
        print('Yes')
        sys.exit()
print('No')

Submission status: Accepted

Solution code:
import sys

s=list(input())
t=list(input())
for i in range(len(s)):
    s.insert(0,s.pop())
    if s == t:
        print("Yes")
        sys.exit()

print("No")

Submission status: Accepted

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

flag = False

for i in range(1,len(S)+1):
    word = "".join(S[-i:]+S[:len(S)-i])
    if word == T:
        flag = True

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

def shift(l,n):
    return l[n:]+l[:n]
flag=True
for i in range(len(s)):
    if flag:
        if s==t:
            flag=False
            print('Yes')
        
        else:
            t=shift(t,1)

if flag:
    print('No')

Submission status: Accepted

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

for i in range(len(S)):
    temp = ""
    for j in range(1,len(S)):
        temp += S[j]
    
    temp += S[0]
    S = temp
    # print(temp)
    if S == T:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

Solution code:
from collections import*
a=deque(input())
b=deque(input())
for i in range(len(a)):
	b.rotate()
	if a==b:
		print("Yes")
		exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

flag = 0
cnt = 0
while cnt <= len(s):
    if s == t:
        flag = 1
        break
    else:
        cnt += 1
        s = s[-1]+s[0:len(s)-1]

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

Submission status: Accepted

Solution code:
s = list(input())
t = input()
li = []
def rotate(l, n):
    return l[n:] + l[:n]
for i in range(len(s)):
    li.append("".join(rotate(s, i)))    
print("Yes" if t in li else "No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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=list(input())
t=input()
l=len(s)
c=0

if "".join(s)==t:
    c=1
else:
    for i in range(l-1):
        n=s[-1]
        del s[-1]
        s.insert(0,n)
        if "".join(s)==t:
            c=1
            break
    
print("Yes" if c==1 else "No")

Submission status: Accepted

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

Submission status: Accepted

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

n = len(s)

ans = 'No'
for i in range(n):
    ok = True
    for j in range(n):
        if s[j] != t[(i+j)%n]:
            ok = False

    if ok:
        ans = 'Yes'

print(ans)

Submission status: Accepted

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

if a == b:
    print("Yes")
else:
    flag = False
    for i in range(1,len(a)):
        a_new = a[-i:] + a[:-i]
        if a_new == b:
            flag = True
            break
    if flag:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

for i in range(len(s)):
    tmp = s[i:] + s[:i]
    if tmp == t:
        check  = 1

if check == 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input().split()[0]
t = input().split()[0]

if set(s) != set(t):
    ans = 'No'
elif s == t:
    ans = 'Yes'
else:
    is_match = False
    for i in range(len(s)):
        part_1 = s[-i-1:]
        part_2 = s[:-i-1]
        # print('{} - {}'.format(part_1, part_2))
        work = part_1 + part_2
        if t == work:
            is_match = True
            break
    ans = 'Yes' if is_match else 'No'

print(ans)

Submission status: Accepted

Solution code:

s = input()
t = input()

res = False
for _ in range(len(s) + 1):
    s = s[1:] + s[0]
    if s == t:
        res = True

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

Submission status: Accepted

Solution code:
s=input()
t=input()
if s in t + t:
    print("Yes")
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'
        break
    T = T[-1] + T[0:-1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

flag = 0
for i in range(N):
    x = S.pop()
    S.insert(0,x)
    if S == T:
        flag = 1
        break

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

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    S = input()
    T = input()
    tmp = S
    for i in range(len(S)):
        tmp = tmp[-1]+tmp[:len(S)-1]
        if tmp == T:
            print('Yes')
            return
    print('No')
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def rolling(str , n):
    return str[n:len(str)] + str[:n]

S = input()
T = input()
for i in range(len(S)):
    if rolling(S, i) == T:
        print("Yes")
        exit()
print("No")