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

res = False
for _ in range(len(s)):
    c = s.pop()
    s.insert(0, c)
    if t == s:
        res = True
if res:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

    ans = f(S, T)
    if ans:
        print("Yes")
    else:
        print("No")


def f(S, T):
    return T in (S + S)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def rotete(S, T):
    S_len = len(S)
    
    for _ in range(S_len):
        if S == T:
            return "Yes"
        S = S[S_len-1] + S[:S_len-1]
        
    return "No"

print(rotete(S, T))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str1 = input()
str2 = input()

if str1 == str2:
    print('Yes')

else:
    for i in range(len(str1) - 1):
    
        str1 = str1[-1] + str1[:-1]
    
        if str1 == str2:
            print('Yes')
            break
    
    if str1 != str2:
        print('No')

Submission status: Accepted

Solution code:
from collections import deque

s = deque(input())
t = deque(input())
ans = 0
for i in range(0,len(s)):
    tmp = s.pop()
    s.appendleft(tmp)
    if s == t:
        ans = 1

if ans == 1:
    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
    else:
        s = s[-1] + s[:-1]
print(ans)

Submission status: Accepted

Solution code:
import sys
ip1 = input()# your code goes here
ip2 = input()
if(len(ip1)!=len(ip2)):
	print("No\n")
	sys.exit()
if(ip1==ip2):
	print("Yes\n")
	sys.exit()
for i in range(len(ip1)):
	for j in range(i+1,len(ip1)):
		st1 = ip1[j:len(ip1)]+ip1[0:j]
		if(st1==ip2):
			print("Yes\n")
			sys.exit()
print("No\n")
sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s,t=input()*2,input()
print(['No','Yes'][t in s])

Submission status: Accepted

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

for i in xrange(len(S)):
    if T.startswith(S[i:]) and T.endswith(S[:i]):
        print "Yes"
        break
else:
    print "No"

Submission status: Accepted

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

main()

Submission status: Accepted

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

n = len(a)

ans = False

for i in range(0, n):
    if a[i:n] + a[0:i] == b:
        ans = True
        break

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

Submission status: Accepted

Solution code:
S = input()
T = input()
f=0
for i in range(len(S)):
    if S == T:
        f=1
    S = (S[-1]+S)[:-1]

if f==0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if t in s:
  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')
		quit()
	tmp = S[-1]
	del S[-1]
	S.insert(0, tmp)
print('No')

Submission status: Accepted

Solution code:
# coding: utf-8
a=input()
b=input()
for i in range(len(a)):
    if b==a[i:]+a[:i]:
        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[i:] + t[:i]:
        ans = "Yes"
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

s = input();
t = input();
def rotate(s):
    s = s[len(s)-1:len(s)]+s[0:len(s)-2]+s[len(s)-2:len(s)-1]
    #print(s)
    return s
if len(s) == 1:
    if s==t:
        print('Yes')
    else:
        print('No')
else:
    flag = 0
    #print(len(s))
    for i in range(len(s)):
        s = rotate(s)
        if s==t:
            print('Yes')
            flag =1
            break
    if flag ==0:
        print('No')

Submission status: Accepted

Solution code:
S,T = input(),input()
rs = ''
OK = False if S!=T else 'Yes'
for i in range(len(S)):
    S = S[-1]+S[0:-1]
    if S==T:
        OK = True
print('Yes' if OK else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# --------------------------------------------

dp = None

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

    for i in range(len(S)):
        S = S[-1] + S[:-1]

        if S == T:
            print("Yes")
            sys.exit()
    
    print("No")


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8


def rotate(strg, n):
    return strg[n:] + strg[:n]


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

    for i in range(len(s)):
        if rotate(s, i) == t:
            print("Yes")
            return

    print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s=list(input())
ss=list(input())
t=s.copy()
for i in t:
    s.pop(0)
    s.append(i)
    if s==ss:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    s = input()
    t = input()
    n = len(s)
    for i in range(n):
        ss = s[i:] + s[:i]
        if ss == t:
            print('Yes')
            return
    print('No')

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#a = int(input())
#b,c = map(int,input().split())
#s = input()
#list_s = list(input())
#list_int = list(map(int,input().split()))

#list = [0 for i in range(n)]
#dp = [[0 for i in range(A)] for j in range(B)]

#list_int 並べて出力 print (' '.join(map(str,ans_li)))
#list_str 並べて出力 print (' '.join(list))

# 2進数 format(10, 'b') # '1010'

# aa=[int(input()) for i in range(n)]

#for i,name in enumerate(list)

''' 二次元配列を一列ずつ
for i in ans:
	print(*i)
'''
''' heapq
queue = []
heapq.heapify(queue) #heapqの作成
heapq.heappush(queue,num) #numのpush(値の追加)
pop = heapq.heappop(queue) #numのpop(最小値の出力)
pop = heapq.heappushpop(queue,num) #push -> pop

'''

from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7


S1 = input()
S2 = input()

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

print('No')

Submission status: Accepted

Solution code:
a=input()
b=input()
h=0
t=False
while h<len(a):
    if a==b:
        print("Yes")
        t=True
        break
    a=a[len(a)-1]+a[:len(a)-1]
    
    h+=1
if t==False:
    print("No")

Submission status: Accepted

Solution code:
s=input();print(["No","Yes"][input()in[s[i:]+s[:i]for i in range(len(s))]])

Submission status: Accepted

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

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

Submission status: Accepted

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

n = len(S)
def same(i, j):
    for k in range(0, n):
        if(S[(i + k)%n] != T[(j + k)%n]):
            return 0
    return 1


ans = 0
for i in range(0, n):
    ans |= same(i, 0)


if ans:
    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()
    s = s[-1]+s[:-1]
print('No')

Submission status: Accepted

Solution code:
n = input()
n2 = input()

nl = []
for i in range(len(n)):
    nl.append(n[i:] + n[:i])

if n2 in nl:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def solve(s, t):
    n = len(s)
    for i in range(n):
        u = s[i:] + s[:i]
        if u == t:
            return "Yes"
    return "No"

assert solve("kyoto","tokyo") == "Yes"
assert solve("abc", "arc") == "No"
assert solve("aaaaaaaaaaaaaaab", "aaaaaaaaaaaaaaab") == "Yes"
s = raw_input()
t = raw_input()
print solve(s, t)

Submission status: Accepted

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

for i in range(n):
    x = s[i:n]
    x.extend(s[:i])
    if x == t:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
# coding:utf-8

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

for i in range(len(S)):
    temp = S.pop(-1)
    S.insert(0, temp)
    if S==T:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
#abc103b
import sys

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

Submission status: Accepted

Solution code:
s=input()
t=input()
count=0
ans='No'
while count<len(s):
    if s==t:ans='Yes'
    s=s[-1]+s[:-1]
    count+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input().strip()
T = input().strip()
# S+SはSを回転させた文字列のすべてを含む
ans = 'Yes' if T in S+S else 'No'
print(ans)

Submission status: Accepted

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

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

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

print("No")

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

    for i in range(len(s)):
        mod_s = mod_s[1:] + mod_s[0]

        if mod_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)):
  if S == T:
    ans = "Yes"
    break
  S.insert(0, S[-1])
  S.pop(-1)
print(ans)

Submission status: Accepted

Solution code:
s = input()
t = input()
ans = False
#tests = s
for i in range(len(s)):
    #print(s)
    if s == t:
        ans = True
        break
    s = s[-1] + s[0 : len(s) - 1]

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for s_index  in range(len(s)):
    for t_index in range(len(t)):
        flag = True
        index = (s_index + t_index) % len(s)
        if s[index] != t[t_index]:
            flag = False
            break
    if flag:
        ans = "Yes"
        break

print(ans)

Submission status: Accepted

Solution code:
s1,s2 =input(),input()
for i in range(len(s1)):
    if(i==0):
        if(s1==s2):
            print("Yes")
            break
    if(s1[i:]+s1[:i] == s2):
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

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

print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
T=input()
if(len(S)==len(T)):
    length=len(S)
    i=0
    while(i<length):
        if(S==T):
            print('Yes')
            break
        S=S[-1]+S[0:-1]
        i+=1
    if i==length:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
def na(): map(int,sys.stdin.readline().split())
def ns(): return sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
s = input()
t = input()
for i in range(len(s)):
  if s[i] == t[0]:
    j, k =  i + 1, 1
    while k <= len(t):
      j %= len(s)
      if k == len(s): 
        print('Yes')
        exit(0)
      if s[j] != t[k]: 
        break
      k += 1
      j += 1
print('No')

Submission status: Accepted

Solution code:
ans = []
a,b = input(),input()
for _ in range(len(a)):
    st =  a[(len(a)-1)-_:]+a[:((len(a)-1)-_)]
    ans.append(st)
print("Yes"if b in ans else "No")

Submission status: Accepted

Solution code:
a=input()
b=input()
print("Yes" if (a+a).find(b) != -1 else "No")

Submission status: Accepted

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

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

Submission status: Accepted

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

#  0 to len - 1
for i in range(len(s1)):
    tmp = s1[i + 1:] + s1[:i + 1]
     
    if tmp == s2:
        print('Yes')
        exit(0)
    
    
print('No')

Submission status: Accepted

Solution code:
from collections import deque

S = input()
T = input()
N = len(S)

ans = False
QS = deque(list(S))

for _ in range(N):
    QS.appendleft(QS.pop())
    A = ''.join(QS)
    if A == T:
        ans = True
        break

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

Submission status: Accepted

Solution code:
import numpy as np

s = list(input())
t = list(input())

i = 0
while True:
    s = list(np.roll(s,-1))
    i += 1
    if s == t:
        print("Yes")
        break
    elif i >= len(s):
        print("No")
        break

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 = False

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

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

Submission status: Accepted

Solution code:
s=input()
t=input()
i=0
h=0
while i<=len(s):
    if (s[i+1:]+s[0:i+1]==t):
        h=1
        break
    i+=1
if h:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
c = raw_input().split()
d =raw_input().split()
 
 
a = list(c[0])
b = list(d[0])
 
 
size= len(a)
bsize = len(b)
 
numsum = 0
numsummax =0
 
for i in range(size): 
    numsum = 0
    for j in range(size): 
        
 
            
        if a[j] == b[(i+j)%size]: 
 
            numsum = numsum +1
            
        else:
            numsum = 0
            
        
    if numsummax<numsum:
            numsummax = numsum
 
if size == bsize and numsummax == size: 
    print "Yes" 
else: 
    print "No"

Submission status: Accepted

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

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

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

Submission status: Accepted

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

flag=0
if a==b:
    flag=1
else:
    for i in range(len(a)):
        a=a[-1:]+a[:-1]
        if a==b:
            flag=1
            break

if flag==1:
    print('Yes')
elif flag==0:
    print('No')

Submission status: Accepted

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

for i in range(L):
    T = T[-1] + T[:-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[len(s)-1] + s[0:-1]
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

S = raw_input()
T = raw_input()

sz = len(S)
S += S

for i in range(sz):
    if S[i : i + sz] == T:
        print "Yes"
        exit()

print "No"

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
from fractions import gcd
S =[i for i in input()]
T =[i for i in input()]
ans = False
for i in S:
    if S == T :
        ans = True
        break
    S.append(S.pop(0))
if ans :
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s,t=list(input()),list(input())
n,ans=len(s),False
for i in range(n):
	flag=True
	for j in range(n):
		if s[j]!=t[(i+j)%n]:
			flag=False
			break
	if flag:
		break
print("Yes"if flag else"No")

Submission status: Accepted

Solution code:
def rotate(s):
    return s[-1] + s[:-1]

if __name__ == '__main__':
    s = input()
    t = input()

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

Submission status: Accepted

Solution code:
T = raw_input()
Tlist = list(T)
S = raw_input()

i = 0
while i < len(Tlist):
  i = i+1
  Tword = ''
  for j in range(0,len(Tlist)):
    Tword = Tword + Tlist[j]

  if Tword == S:
    print('Yes')
    break

  last_word = Tlist[-1]
  new_List =[0 for k in range(len(Tlist))]
  for j in range(1,len(Tlist)):
    new_List[j]=Tlist[j-1]
  new_List[0]=last_word
  Tlist = new_List

if Tword != S:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S,T=input()*2,input()
print(['No','Yes'][T in S])

Submission status: Accepted

Solution code:
a = input()
b = input()
c = len(a)
a_list = list(a)
b_list = list(b)
for i in range(101):
  tmp = a_list[0]
  for j in range(c-1):
    a_list[j] = a_list[j+1]
  a_list[c-1] = tmp
  if a_list == b_list:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

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

A = S
for i in range(len(S)):
    AA = list(A[len(S) - 1])
    B = A[0:len(S) - 1]
    AA.extend(B)
    A = AA
    if A == T:
        p = 1
        break
    else:
        p = 0
        
if p == 1:
    print('Yes')
else:
    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 = [s[len(s) - 1]] + s[:len(s) - 1]
else:
    print('No')

Submission status: Accepted

Solution code:
from sys import stdin                                                                                                                                                                                       
S = stdin.readline().rstrip()                                                                                                                                                                               
T = stdin.readline().rstrip()                                                                                                                                                                               
                                                                                                                                                                                                            
sl = list(S)                                                                                                                                                                                                
for x in range(len(S)):                                                                                                                                                                                     
    if S == T:                                                                                                                                                                                              
        print("Yes")                                                                                                                                                                                        
        break                                                                                                                                                                                               
    fin = sl.pop()                                                                                                                                                                                          
    sl =list(fin) + sl                                                                                                                                                                                      
    sl2 = "".join(sl)                                                                                                                                                                                       
    if sl2 == T:                                                                                                                                                                                            
        print("Yes")                                                                                                                                                                                        
        break                                                                                                                                                                                               
    if x == len(S) - 1:                                                                                                                                                                                     
        print("No")

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
flag=False
cnt=0
if sorted(s)==sorted(t):
  a=s.index(t[0])
  for i in range(len(s)):
    b=i+a
    if b>=len(s):
      b-=len(s)
    if s[b]==t[i]:
      cnt+=1

if cnt==len(s):
  flag=True
print('Yes' if flag else 'No')

Submission status: Accepted

Solution code:
input1 = raw_input().replace("\n", "")
input2 = raw_input().replace("\n", "")

if len(input1) != len(input2):
    print "No"
else:
    n_len = len(input1)

result = "No"
for i in xrange(n_len):
    input1_new = input1[i:] + input1[:i]
    if input1_new == input2:
        result = "Yes"
        break
print result

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

B = False

for s in S:
    if S == T:
        B = True
    else:
        p = S[0]
        del S[0]
        S.append(p)

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

Submission status: Accepted

Solution code:
def B():
    s1 = input()
    s2 = input()
    
    YES = 'Yes'
    NO = 'No'
    
    result = NO
    for i in range(len(s1)):
        p = s1[i:] + s1[:i]
        if(p in s2):
            result = YES
    
    print(result)
        
if __name__ =='__main__':
    B()

Submission status: Accepted

Solution code:
inp = [input() for _ in range(2)]
s = inp[0]
t = inp[1]
 
s = list(s)
t = list(t)

for i in t:
    t.append(t[0])
    t.pop(0)
    if s == t:
        print("Yes")
        break
if s != t:
    print("No")

Submission status: Accepted

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

is_success = False
temp_s = s
for _ in range(len(s)):
    temp_s = temp_s[1:]+temp_s[0]

    if temp_s == t:
        is_success = True

print('Yes' if is_success else 'No')

Submission status: Accepted

Solution code:
def spaceinput():
    return list(map(int,input().split(" ")))

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

s=input()
s2=input()

def chk(s,s2):
    for i in range(len(s)):
        #print(s2)
        if s==s2:
            return True
        s2=rotate(s2)

    return False

if chk(s,s2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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


def rotation(s):
    for x in range(len(s)):
        s = s[-1] + s[:-1]
        if s == t:
            return "Yes"
    return "No"

print(rotation(s))

Submission status: Accepted

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

Submission status: Accepted

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

flag = False
for i in range(len(s)):
    if (s == t):
        flag = True
        break
    ls = s
    s.append(ls[0])
    s.pop(0)

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

Submission status: Accepted

Solution code:
import re
S = input()
T = input()
S2 = S * 2
if re.search(T, S2):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

l=len(a)

for i in range(0,l) :

    s=a[i+1:]+a[:i]+a[i]

    if s==b:
        x=1
        break
    else:
        x=0


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

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()

a = int(len(s))

for i in range(0,a) :
    s = s[a-1::]+s[:a-1:]
    if s == t :
        print("Yes")
        sys.exit()

print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
s1 = list(s)
t1 = list(t)
ls = len(s1)
ls1=ls-1
lt = len(t1)
z=0
if s1 == t1:
	z = 1
elif s1!=t1:
    for i in range(ls-1):
        x = s1[0]
        y = s1[ls1]
        del s1[ls1]
        s1.insert(0,y)
        if s1 == t1:
            z = 1
if z == 0:
    print("No")
else:
  print("Yes")

Submission status: Accepted

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

for i in range(len(S)):
    if S == N:
        a = 1
        break
    elif S[-i:] + S[0:len(S) - i] == N:
        a = 1
        break

    else:
        a = 0

if a == 1:
    print("Yes")

else:
    print("No")