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

s=list(s)
t=list(t)
u=s[:]

for i in range(len(s)):
    u.append(s[i])
    u.remove(u[0])
    if u==t:
        print('Yes')
        sys.exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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
print("Yes" if ans==1 else "No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
list_s = list(input())
list_t = list(input())
n = len(list_s)
for i in range(0, n):
    if "".join(list_s) == "".join(list_t):
        print("Yes")
        exit()
    list_s.insert(0, list_s[n - 1])
    list_s.pop(-1)
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# 初期入力
import sys

#input = sys.stdin.readline  #文字列では使わない
S =input().strip()
T =input().strip()
ans ="No"
for _ 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()

if S == T:
    print("Yes")
else:
    ans = "No"
    S = list(S)
    for i in range(len(S)):
        s = S.pop()
        S.insert(0, s)
        if "".join(S) == T:
            ans = "Yes"
            break
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if t in s*2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(S)):
    if S == T:
        print('Yes')
        break
    else:
        lstS = list(S)
        s = lstS.pop()
        a = list(s) + lstS
        S = ''.join(a)
        
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
flag = 0
for i in range(len(S)):
  if S == T:
    flag = 1
    break
  S = S[len(S)-1] + S[0:len(S)-1]
if flag == 1:
  print('Yes')
else:
  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()

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

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

print('No')

Submission status: Accepted

Solution code:
from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s = input()
t = input()
n = len(s)

for i in range(n):
    flag = 0
    for j in range(n):
        if s[(i+j)%n] != t[j]:
            flag = 1
            break
    if flag == 0:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
s = lines.pop(0)
t = lines.pop(0)
for i in range(len(s)):
    if s[i:] + s[:i] == t:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()
    T = SS()
    l = len(S)
    S2 = S * 2

    ans = 'No'
    for i in range(l):
        if S2[i:i+l] == T:
            ans = 'Yes'
            break

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

check = False
for i in range(N):
  S = S[-1] + S[:-1]
  if S == T:
    check = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

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

Submission status: Accepted

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

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()
T = input()
for i in range(len(S)):
    if T == S:
        print("Yes")
        exit()
    else:
        T = T[-1] + T[:-1]
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 = list(input())
t = list(input())
cnt = 0
for i in range(len(s)):
    x = t[-1]
    t.pop()
    t.insert(0, x)
    if s == t:
        print("Yes")
        break
    else:
        cnt += 1
        if cnt == len(s):
            print("No")
            break

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    l = len(S)

    def judge():
        for i in range(l):
            U = S[l - i:] + S[:l - i]
            if U == T:
                return True
        return False

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

if __name__ == '__main__':
    main()

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)
s,t=[],[]
for i in range(n):
  s.append(S[i])
  t.append(T[i])
for i in range(n):
  p=s[0]
  for j in range(1,n):
    s[j-1]=s[j]
  s[n-1]=p
  if s==t:
    print('Yes')
    exit()
print('No')

Submission status: Accepted

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

else:
  print("No")

Submission status: Accepted

Solution code:
def role(s:str):
    s0, s1 = s[:len(s)-1], s[len(s)-1]
    return s1 + s0

def main():
    s = input()
    t = input()
    for _ in range(len(t)):
        if s == t:
            print('Yes')
            return
        s = role(s)
    print('No')

if __name__ == "__main__":
    main()

Submission status: Accepted

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

u = deque(s)
ok = False
for i in range(len(s)):
  u.rotate(1)
  if ''.join(u) == t:
    ok = True
    
print('Yes' if ok else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
T1 = T * 2

if S in T1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

print("Yes") if cnt > 0 else print("No")

Submission status: Accepted

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

print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
s = deque(input())
t = deque(input())
for i in range(len(s)):
    if s == t:
        print("Yes")
        exit()
    s.append(s[0])
    s.remove(s[0])
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for _ in range(len(S)):
    c = S.pop(0)
    S.append(c)
    if S == T:
        print('Yes')
        exit()

print('No')

Submission status: Accepted

Solution code:
S = input().rstrip()
T = input().rstrip()
flg = False
for i in range(len(S)):
    cnt = 0
    for j, s in enumerate(S):
        if s==T[j-i]: cnt += 1
    if cnt==len(S):
        flg = True
if flg:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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


def read():
    S = input().strip()
    T = input().strip()
    return S, T


def solve(S, T):
    N = len(S)
    for i in range(N):
        is_matched = True
        for j1 in range(N):
            j2 = (i + j1) % N
            if S[j1] != T[j2]:
                is_matched = False
                break
        if is_matched:
            return "Yes"
    return "No"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

S_new=S

ans="No"

for i in range(len(S)):
    S_new = S_new[-1]+S_new[:-1]
    if S_new == T:
        ans="Yes"
        break
    else:
        continue
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

S_new=S

ans="No"

for i in range(len(S)):
    S_new = S_new[-1]+S_new[:-1]
    if S_new == T:
        ans="Yes"
        break
    else:
        continue
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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


u = s + s

flag = False
j = 0

for i in range(len(u)):
    if u[i] == t[j]:
        j += 1
        if j == len(t):
            flag = True
            break
    else:
        j = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

s2 = S*2
if T in s2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
n = len(S)
s = []
t = []
for i in S:
  s.append(i)
for i in T:
  t.append(i)
  
for i in range(n):
  res = s[0] 
  for j in range(1, n):
    s[j-1] = s[j]
  s[n-1] = res
  if s == t:
    print('Yes')
    exit()
    
print('No')

Submission status: Accepted

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

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:
def kaiten(x):
    a=x[:-1]
    x=x[-1:]
    return x+a


S=str(input())
T=str(input())
ans="No"
for i in range(len(S)):
    if S==T:
        ans="Yes"
        break
    S=kaiten(S)

print(ans)

Submission status: Accepted

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

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

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

else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque 
S = deque(input())
T = input()

result = 'No'
for i in range(len(S)):
    a = S.pop()
    S.appendleft(a)
    if ''.join(S) == T:
        result = 'Yes'
        break
print(result)

Submission status: Accepted

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

s = S
for i in range(S_len):
    s_list = list(s)
    s_end = s_list.pop()
    b = s_end + ''.join(s_list)
    if b == T:
        print('Yes')
        exit(0)
    s = b
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(s)):
    S = s[-(i+1):]+s
    if S[:len(s)] == t:
        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:
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()

def resolve():
    import sys
    input = sys.stdin.readline
    s = input().rstrip()
    t = input().rstrip()

    for i in range(100):
        rotated = s[i:] + s[:i]
        if rotated == t:
            print("Yes")
            return

    print("No")

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
flag = False
for i in range(len(s)):
    if s == t:
        flag =True
    s = s[-1] + s[0:len(s)-1]
if flag:
    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(0)
    a = s[0]
    s.pop(0)
    s.append(a)
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()
for i in range(len(s)):
    s=s[1:len(s)]+s[0]
    if t==s:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for _ in range(len(S) + 1):
    if S == T:
        print("Yes")
        break
    S.append(S.pop(0))
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

flag = False
count = 0
while True:
    if S == T:
        flag = True
        break

    if count == len(S):
        break
    
    S = S[-1] + S[:len(S) - 1]
    count += 1

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    T = readline().strip()

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

    print('No')
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

s = input()
t = input()


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

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

l = len(s)

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

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 = list(input().strip())
T = list(input().strip())
f = False
for _ in range(len(T)+1):
    if S == T:
        f = True
        break
    t = T.pop(0)
    T.append(t)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

s = input()
t = input()

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

print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
N = len(S)
x = 0
if S == T:
    print('Yes')
    exit()
while S != T:
    if x > N:
        print('No')
        exit()
    else:
        S = S[N - 1] + S
        S = S[0:N]
        x += 1
        if S == T:
            print('Yes')
            exit()

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)
x = 0
if S == T:
    print('Yes')
    exit()
while S != T:
    if x > N:
        print('No')
        exit()
    else:
        S = S[N - 1] + S
        S = S[0:N]
        x += 1
        if S == T:
            print('Yes')
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print('NYoe s'[input() in input()*2::2])

Submission status: Accepted

Solution code:
from collections import deque
s,t=deque([*input()]),deque([*input()])
for _ in range(len(s)):
  if s==t: print('Yes');break
  s.rotate(1)
else:
  print('No')

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

S = input()
T = input()

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

Submission status: Accepted

Solution code:
S=list(str(input()))
T=list(str(input()))
for i in range(len(S)):
    S.append(S[i])
j=0
while j+len(T)<=len(S):
    if S[j:j+len(T)]==T:
        print('Yes')
        exit()
    j+=1

print('No')

Submission status: Accepted

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

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

    s1 = S[0]
    s2 = S[1:]
    S = s2 + s1

print("No")

Submission status: Accepted

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

Submission status: Accepted

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

s+=s

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

s = str(input())
t = str(input())


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

print("No")

Submission status: Accepted

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

Submission status: Accepted

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

    for i in range(len(S)):
        if S == T:
            print('Yes')
            return
        else:
            p = S.pop(-1)
            S.insert(0, p)
    print('No')
main()

Submission status: Accepted

Solution code:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

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

res = False
for _ in range(len(s)):
    if s == t:
        res = True
        break
    s = s[1:] + s[0]
print('Yes' if res else 'No')

Submission status: Accepted

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


cnt = 0
while cnt < 100000:
    last = s.pop()
    s.appendleft(last)
    if s == t:
        print('Yes')
        exit()
    cnt += 1
print('No')

Submission status: Accepted

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

def rot(s):
  return s[-1]+s[:-1]

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