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

Submission status: Accepted

Solution code:
s=input()
t=input()
s=s+s#kyotokyoto
k=0
flag=False
for i in s:
  if k<=(len(t)-1) and i==t[k]:
    k+=1
  else:
    k=0
  if k==(len(t)-1):
    flag=True
if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = input()
#文字列の長さ
a = len(s)
b = "No"
#適当なx
x = a
for _ in range(a):
  x =s[0]
  for i in range(a-1):
    s[i]=s[i+1]
  s[-1]=x
  s = "".join(s)
  if s==t:
    b='Yes'
    break
  else:
    s = list(s)
print(b)

Submission status: Accepted

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

for k in range(len(S)):
    for i in range(len(S)):
        if S[i] == T[i - k]:
            continue
        else:
            break
    else:
        ans = 'Yes'
        break
else:
    ans = 'No'

print(ans)

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:
s = input()
t = input()
l = []
cnt = 0
for i in s:
    l.append(i)
for j in range(len(s)):
    l.insert(0, l[len(s) - 1])
    
    #print(l[:len(s)])
    
    if "".join(l[:len(s)]) == t:
        cnt += 1
if cnt >= 1:
    print("Yes")
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()

L = len(S)

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

answer = 'Yes' if bl else 'No'
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

def same(s1,s2):
    for i in range(len(s1)):
        if s1[i] != s2[i]:
            return False
    return True

for i in range(111):
    if same(s,t):
        print("Yes")
        exit()

    tmp = s.pop(0)
    s.append(tmp)

print("No")

Submission status: Accepted

Solution code:
s = input(); t = input()
c = 0 #無限ループを防ぐためのカウンターを設置
     
while (s != t):
	s = s[-1] + s[:-1]
	c += 1
	if c == len(s):
		print('No')
		break
        
if s == t:
	print('Yes')

Submission status: Accepted

Solution code:
from collections import deque
s=deque(input())
t=input()
for _ in range(len(t)+2):
  if ''.join(s)==t:
    print('Yes')
    exit()
  s.appendleft(s[-1])
  s.pop()
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Wed Mar 11 16:31:16 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

S = ns()
T = ns()
N = len(S)
flag = False

for i in range(N + 1):
    q = S[:i]
    p = S[i:]
    if p + q == T:
        flag = True
    
print("Yes" if flag else "No")

Submission status: Accepted

Solution code:
s = input(); t = input()
c = 0 #無限ループを防ぐためのカウンターを設置

while (s != t):
    s = s[-1] + s[:-1]
    c += 1
    if c == len(s):
        print('No')
        break
    
if s == t:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
if(s == t):
    print("Yes")
    exit()

n = len(s) - 1
for _ in range(n):
    a = s[-1] + s[:-1]
    if(a == 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)):
    compstr = s[i:] + s[0:i]
    if compstr == t:
        print("Yes", end="")
        exit()
print("No", end="")

Submission status: Accepted

Solution code:
a =input()
a = [str(c) for c in a]
b =input()
b = [str(c) for c in b]

c=len(b)
t=0
for i in range(0,c+3):
	a.append(a[0])
	del a[0]
	if a==b:
		t=1
		
if t==1:
	print('Yes')
else:
	print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import deque
s=deque(list(input()))
t=deque(list(input()))
for i in range(120):
  s.rotate(1)
  if s==t:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

lang = len(s) - 1

for i in range(len(s)):
    sub = s[lang]
    del s[lang]
    s.insert(0, sub)
    if s == t:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

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

    for i in range(len(s)):
        s.rotate()
        if s==t:
            print('Yes')
            break
        if i ==len(s)-1:
            print('No')
            break


resolve()

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

if S == T:
    print("Yes")
else:
    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:
import sys
i = list(input())
t = list(input())
for _ in range(len(i)):
  if i == t:
    print("Yes")
    sys.exit()
  else:
    e = i.pop(-1)
    i.insert(0, e)
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,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()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = list(input())
n = len(s)
t = list(input())
for i in range(n+5):
    now = []
    now.append(s[-1]); s.pop(-1) 
    now += s
    s = now
    if s == t:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

Solution code:
import math
import string


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


s = input()
t = input()
# print(s)
# print(t)


def rotate(s):
    a = []
    a.append(s[-1])
    a.append(s[:-1])
    return ''.join(a)


def solve(r):
    if r == s:
        return False
    if r == t:
        return True
    return solve(rotate(r))


if s == t:
    print("Yes")
    exit()
if solve(rotate(s)):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print("YNeos"[input() not in input()*2::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Problem B - String Rotation

S = input()
T = input()
is_same = False

for i in range(len(S)):
    S = S[-1] + S[:-1]
    if S==T:
        is_same = True
        break

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

Submission status: Accepted

Solution code:
import sys

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

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

print("No")

Submission status: Accepted

Solution code:
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, groupby
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7


def ns(): return stdin.readline().rstrip()


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


s = ns()
t = ns()
for i in range(len(s)):
    sm = s[i:] + s[:i]
    if sm == t:
        print("Yes")
        quit()
print("No")

Submission status: Accepted

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

n = len(s)
flag2 = 0
for i in range(n):
    flag = 0
    for j in range(n):
        index = min(i + j, i + j - n)
        if s[index] == t[j]:
            flag += 1
    if flag == n:
        print("Yes")
        exit()
    else:
        flag2 += 1
if flag2 == n:
    print("No")

Submission status: Accepted

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

ans = "Yes"
if S != T:
  for _ in range(len(S)):
    a = S[-1]
    S.pop(-1)
    S.insert(0, a)
    if S == T: break
  if S != T: ans = "No"

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
len_T = len(T)
for _ in range(len_T):
    if S == T:
        print("Yes")
        exit()
    else:
        tmp = T.pop(0)
        T.append(tmp)
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(str(input()))
t = list(str(input()))
l = len(s)
for i in range(l):
    if s == t:
        print('Yes')
        exit()
    tmp = s[l-1]
    s = s[:l-1]
    s.insert(0, tmp)
print('No')

Submission status: Accepted

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

ans=0
for i in range(n):
    for j in range(n):
        if s[(i+j)%n]!=t[j]:
            break
        if j==n-1:
            ans=1

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

Submission status: Accepted

Solution code:
from sys import stdin
def main():
	readline=stdin.readline
	S=readline().strip()
	T=readline().strip()
	for i in range(len(S)):
		U=S[i:]+S[:i]
		if U==T:
			print("Yes")
			break
	else:
		print("No")
if __name__=="__main__":
	main()

Submission status: Accepted

Solution code:
def main():
    S = input()
    from collections import deque
    S = deque(S)
    T = input()
    for i in range(len(S) + 1):
        Z = "".join(S)
        if Z == T:
            return print("Yes")
        S.rotate()
    print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(S: str, T: str):
    f = False
    n = len(S)
    for i in range(n):
        if S[n-i:]+S[:n-i] == T:
            f = True

    if f:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()

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()
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:
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=(input())
t=(input())
ss=s+s
n=len(s)
flag=False
for i in range(0,n):
    if ss[i:i+n]==t:
        print("Yes")
        sys.exit()
print("No")

Submission status: Accepted

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

ans = "No"
for i in range(len(S)+1):
    tmp = S.pop(0)
    S.append(tmp)
    ##print(S)
    if S == T:
        ans = "Yes"
        break

print(ans)

Submission status: Accepted

Solution code:
#ABC103

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

Submission status: Accepted

Solution code:
from collections import deque


def main():
    S = deque(list(map(str, input())))
    T = input()

    for _ in range(len(S)):
        if "".join(S) == T:
            print("Yes")
            return
        else:
            s = S.pop()
            S.appendleft(s)

    print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()*2
T = input()
print("Yes" if S.count(T) > 0 else "No")

Submission status: Accepted

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

for i in range(len(s)):
    s.insert(0, s[-1])
    s.pop(-1)
    if "".join(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()
    tmp=S[-1]
    S=tmp+S[:-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:
# coding: utf-8


def can_match():
    s = input().rstrip()
    t = input().rstrip()
    if s == t:
        return True
    for i in range(1, len(s)):
        tmp = s[i:] + s[0:i]
        if tmp == t:
            return True
    return False


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

Submission status: Accepted

Solution code:
S = input()
T = input()
for i in range(len(S)):
    cnt = i+1
    flag = True
    for j in range(len(S)):
        if cnt >= len(S):
            cnt = 0
        if T[j]!=S[cnt]:
            flag = False
            break
        cnt+=1
    if flag:
        break
print("Yes") if flag else print("No")

Submission status: Accepted

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

for i in range(len(s1)):
    s1=list(s1)
    a = s1.pop(-1)
    s1 = ''.join(s1)
    s1 = a+s1
    #print(s1)
    if s1 == s2:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

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


S = list(s)
T = list(t)

for i in range(len(s)):
  for j in range(len(S)-1):
    S.append(S[j])
  del S[0:len(s)-1]
  
  if ("".join(S)) == t:
    print("Yes")
    exit()
    
print("No")

Submission status: Accepted

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

def rotate(S) :
    P = []
    P = S[1:]
    P.append(S[0])
    return P

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

print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
p = 0
for i in range(len(s)):
    s.append(s[0])
    s.pop(0)
    if s == t:
        print('Yes')
        break
    else:
        p += 1
if p == len(s):
    print('No')

Submission status: Accepted

Solution code:
import sys

def main():
    S = list(input())
    T = list(input())
    for i in range(len(S)):
        if S[i:] + S[:i] == T:
            print("Yes")
            sys.exit()
    print("No")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = False

for _ in range(len(t)):
    if s == t:
        ans = True
        break
    else:
        tmp = t[0]
        t.remove(t[0])
        t.append(tmp)

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
f = False
l = len(s)
p = ["" for _ in range(l)]
if s == t: f = True
for i in range(l):
	for j in range(l):
		p[(j+i)%l] = t[j]
	if s == p: 
		f = True
if f: print("Yes")
else: print("No")

Submission status: Accepted

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

S = input().strip()
T = input().strip()

for i in reversed( range(len(S)) ):
  r_S =S[i:len(S)] + S[0:i]
  
  if r_S == T:
    print("Yes")
    break

else:
  print("No")

Submission status: Accepted

Solution code:
s, t = [input() for i in range(2)]
n = len(s)
can = False
for i in range(n):
    if s == t:
        can = True
        break
    else:
        s = s[n - 1] + s[0:n - 1]
print('Yes' if can else '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 = list(input())
T = list(input())

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

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

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s=STR()
    t=STR()
    flg=0
    for i in s:
        s=s[1:]+s[0]
        if s==t:
            flg=1
    if flg==1:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
S=list(input())
T=list(input())
s=len(S)
def swap(X,i,j):
  x=X[i]
  X[i]=X[j]
  X[j]=x
def swaplist(S):
  for i in range(1,s):
    swap(S,s-i,s-i-1)
  return S
count=0
if S==T:
  count=count+1
else:
  for i in range(s):
    if T==swaplist(S):
      count=count+1
if count==0:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
S = input()
T = input()
s = []
t = []
for i in range(len(S)):
  s.append(S[i])
  t.append(T[i])
flag = 0
if s == t:
  print("Yes")
  flag += 1
else:
  for i in range(len(s)):
    A = s[0]
    s.remove(A)
    s.append(A)
    if s == t:
      print("Yes")
      flag += 1
      break
if flag == 0:
  print("No")

Submission status: Accepted

Solution code:
s=list(str(input()))
t=list(str(input()))
def swap(s):
            s_a=s[:-1]
            s_b=list(s[-1])
            s_b.extend(s_a)
            sb="".join(s_b)
            return s_b
for i in range(len(s)):
            s=swap(s)
            if s==t:
                        print('Yes')
                        exit()
print('No')

Submission status: Accepted

Solution code:
s=input()
t=input()
str_list=[s]

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

Submission status: Accepted

Solution code:
from collections import deque

S = list(input())
T = input()
S = deque(S)
St = S
i = 0
flag = False
while i < len(S):
    if "".join(St) == T:
        flag = True
        break
    else:
        lst = St.pop()
        St.appendleft(lst)

    i += 1
print("Yes") if flag else print("No")

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans=False

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

Submission status: Accepted

Solution code:
s = input()
t = input()
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()
print('YNeos'[s not in t+t::2])

Submission status: Accepted

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

Submission status: Accepted

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

def rotate(s):
  rotate_list = []
  for _ in range(len(s)):
    # 最後の文字を取り出す
    tmp = s[-1]
    # 残りとくっつける
    tmp = tmp + s[0:-1] 
    rotate_list.append( tmp )
    s = tmp
  return rotate_list

l = rotate(S)

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

Submission status: Accepted

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

Submission status: Accepted

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

flag = False
for i in range(len(S)):
    S.append(S[0])
    S.pop(0)

    if S == T:
        flag = True
        break

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
change = s[:]
for i in range(len(s)):
    for j in range(len(s)):
        if j+i >= len(s):
            change[i+j-len(s)] = s[j]
        else:
            change[j+i] = s[j]
    if t == change:
        print("Yes")
        quit()
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = list(map(str, input()))
T = list(map(str, input()))

def judge(S, T):
	for _ in range(len(S)):
		S.insert(0, S.pop(-1))
		if S == T:
			return "Yes"
	return "No"
	
print(judge(S, T))

Submission status: Accepted

Solution code:
#103_B
S=input()
T=input()
flg=False
for i in range(len(S)):
    S=S[-1]+S[:-1]
    if S==T:
        flg=True
print('Yes' if flg else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
T = input()
match = False
for x in range(len(S)):
    rotate = S.pop()
    # rotate = S.(-1:)
    S.insert(0, rotate)
    moji = "".join(S)
    if moji == T:
        match = True

if match == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ss = s+s

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


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

Submission status: Accepted

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

ss = s+s+s

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


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

Submission status: Accepted

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

if S == T:
    print('Yes')
else:
    l = len(S)
    L = list(S)
    for i in range(l):
        a = L[0]
        del L[0]
        L.append(a)
        s = ''.join(L)
        if s == T:
            print('Yes')
            break
    else:
        print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=list(input())
f=False
for x in range(len(t)):
    m=t.pop(0)
    t.append(m)
    if "".join(t)==s:f=True
if f:print("Yes")
else:print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

srot=s*2
if srot.count(t)!=0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

flag = False
for i in range(len(s)):
    tmp =  s[i:] + s[:i]
    if tmp == t:
        flag = True
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = input()
    T = input()
    reslut = 'No'
    for s in S:
        if S == T:
            reslut = 'Yes'
            break
        else:
            S = S[-1] + S[:-1]
    print(reslut)


if __name__ == "__main__":
    main()

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

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

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

Solution code:
def main():
    string = input()
    target = input()
    result = False
    for _ in range(len(target)):
        if string == target:
            result = True
            break
        string = string[-1] + string[:-1]
    if result:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()