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:
# your code goes here
S = list(input())
T = list(input())

ans = False
for i in range(len(S)):
	if S == T:
		ans = True
		break
	S.insert(0,S[-1])
	del S[-1]
		
if ans:
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
# coding:utf-8

S = input()
T = input()

T_list = list(T)
ans = 'No'
S_trans = list(S)
for i in range(len(S)):
    S_trans = list(S_trans[-1]) + list(S_trans[0:-1])
    if S_trans == T_list:
        ans = 'Yes'
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
sc = S
flag = False
for i in range(len(sc)):
    if(sc==T and flag==False):
        print("Yes")
        flag = True
    tmp1 = sc[-1:]
    tmp2 = sc[:-1]
    # print(tmp1)
    # print(tmp2)
    sc = tmp1 + tmp2
if flag == False:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy
s = input()
t = input()
ti = [i for i in range(len(t))]

flg = False
for i in range(len(s)):
    tmp = [t[i] for i in numpy.roll(ti, i)]
    if s == "".join(tmp):
        flg = True
        break
    
if flg:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()

sLen = len(s)

for i in range(sLen):
    sRote = s[1:sLen] + s[0]
    s = sRote
    #print(s)
    if s == 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)):
    if s==t:
        ans="Yes"
        break
    temp=s.pop()
    s.insert(0,temp)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()

def check(i):
	ns = s[i:] + s[:i]
	if ns == t:
		print('Yes')
		sys.exit()
	else:
		return

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

Submission status: Accepted

Solution code:
S_raw = input()
T_raw = input()

S_copy = S_raw
T_copy = T_raw

flag_end = False

# 文字数チェック、不一致ならNo
while S_copy != '':
    str_tmp = S_copy[0]
    if S_copy.count(str_tmp) != T_copy.count(str_tmp):
        print('No')
        flag_end = True
        break
    S_copy = S_copy.replace(str_tmp, '')
    T_copy = T_copy.replace(str_tmp, '')


if flag_end == False:
    for i in range(0, len(S_raw)):
        if S_raw[i:] in T_raw:
            if S_raw[i:]+S_raw[:i] == T_raw:
                print('Yes')
                flag_end = True
                break

if flag_end == False:
    print('No')

Submission status: Accepted

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

flag = 0

for i in range(len(s)):
    s1 = s[0:-1]
    s2 = s[-1]
    s = s2 + s1
    if(s == t):
        flag = 1
        break

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

Submission status: Accepted

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

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

if key == 0:
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
s = input()
t = input()

isok=0

for _ in range(len(s)):
    s = s[1:]+s[0]
    if s == t:
        isok=1
        break

if isok == 1:
    print('Yes')
else:
    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 = raw_input()
T = raw_input()

T_d = T + T
if S in T_d:
    print 'Yes'
else:
    print 'No'

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
ans = "No"
for x in range(len(S)):
    Stel = S[-1]
    del S[-1]
    S.insert(0, Stel)
    if S == T:
        ans = "Yes"
        break
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
turn=str(input())
corrected=str(input())
correct=False
count=0
while(True):
    count=count+1
    if(turn==corrected):
        print('Yes')
        break
    else:
        last=turn[len(turn)-1]
        turn=turn[0:len(turn)-1]
        turn=last+turn
    if(count>100):
        print('No')
        break

Submission status: Accepted

Solution code:
s=input()
t=input()
tmp=s
flag=False
if(len(s)==2 and s[0]==t[1] and s[1]==t[0]):flag=True
    
for i in range(len(s)):
    if(t==tmp):
        flag=True
        break
    tmp=""
    for j in range(len(s)):
        c=i+j
        if(c>=len(s)):
            c-=len(s)
        tmp+=s[c]


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
#_*_coding:utf-8_*_
s = raw_input()
t = raw_input()
lens = len(s)
if lens != len(t):
    print 'No'
    exit(0)
elif s == t:
    print 'Yes'
    exit(0)
else:
    for i in range(1, lens):
        if s[i:] + s[:i] == t:
            print 'Yes'
            exit(0)
print 'No'

Submission status: Accepted

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

count = 0

while s != t and count <= (len(s)-1):
    count += 1
    s.insert(0, s[-1])
    del s[-1]
    
if count > (len(s)-1):
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

is_rotated = False

for i in range(len(s)):
  s.insert(0, s[-1])
  del s[-1]

  if s == t:
    is_rotated = True
    break

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

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

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


def main():
    S = input().strip()
    T = input().strip()
    move = S[-1]+S[:-1]
    j = True
    if move == T:
        print("Yes")
        j = False
        exit()
    while j:
        move = move[-1]+move[:-1]
        if move == T:
            print("Yes")
            j = False
        elif move == S:
            print("No")
            j = False


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if f == 0:
	print("No")

Submission status: Accepted

Solution code:
import sys

w1 = sys.stdin.readline().strip()
w2 = sys.stdin.readline().strip()

for i in range(len(w1)):
    if w1 == w2:
        sys.stdout.write("Yes")
        exit(0)
    w1 = w1[1:] + w1[0]

sys.stdout.write("No")

Submission status: Accepted

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

for i in range(len(S)):
    S.insert(0,S[-1])
    S.pop(-1)
    if S == T:
        Ans = True
        break

if Ans == True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

len_ST = len(S)

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

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

print("No")

Submission status: Accepted

Solution code:
import sys
s, t = [ sys.stdin.readline().rstrip()
         for _ in range(2) ]
n = len(s)
yes = False
for i in range(n):
    if s[i] == t[0] and s[i:] + s[:i] == t:
        yes = True
        break
print("Yes" if yes else "No")

Submission status: Accepted

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

l = len(s)  

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s=input()
t=input()
for i in range(len(s)):
    a=s[:i]
    b=s[i:]
    if t.startswith(b) and t.endswith(a):
        print("Yes")
        sys.exit()
print("No")

Submission status: Accepted

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

s = S
flag = False
if s == T:
    flag = True
else:
    for i in range(len(S)):
        s = s[-1] + s[:-1]
        if s == T:
            flag = True
            break

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

Submission status: Accepted

Solution code:
import sys
s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()
ok = 0
for i in range (len (s)):
  if t == s[i:] + s[:i]:
    ok = 1
print (["No", "Yes"][ok])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = list(input())
T = list(input())

flag = 0
for i in range(0, len(S)):
    tmp = T[0]
    T.pop(0)
    T.append(tmp)
    if S == T :
        flag = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    S = input()
    T = input()
    S_ = S
    for i in range(len(S)):
        if S_ == T:
            print("Yes")
            exit()
        tmp = S_[0]
        S_ = S_[1:] + tmp
    print("No")

Submission status: Accepted

Solution code:
S=input()
listS=[]
for i in range(len(S)):
    listS.append(S[i])

T=input()
listT=[]
for j in range(len(T)):
    listT.append(T[j])

if len(listS)!=len(listT):
    print("No")
else:
    count=0
    for k in range(len(S)):
        listS.insert(0,listS[len(S)-1])
        del listS[len(S)]
        if listS==listT:
            print("Yes")
            break
        else:
            count+=1
    if count==len(S):        
        print("No")

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

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

ans  ="No"
#素直に
for i in range(len(s)):
    tmp = s[-1] + s[0:-1]
    #print(tmp)
    if tmp == t :
        ans ="Yes"
        break
    s = tmp

print(ans)

Submission status: Accepted

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

ans = 'No'

for _ in range(len(s)):
    last = s[-1]
    s = last + s[:-1]
    if s == t:
        ans = 'Yes'
        break

print(ans)

Submission status: Accepted

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

# 文字列の入力
s = raw_input()
t = raw_input()

isOk=False
for i in range(len(s)):
	c=''.join(list(s)[i:]+list(s)[:i])
	if t == c:
		print 'Yes'
		isOk=True
		break

if not isOk:
	print 'No'

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

flag = False
s_tmp = S
for cnt in range(len(S)):
    s_tmp = s_tmp[-1] + s_tmp[:-1]
    if s_tmp == T:
        flag = True
        break

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

Submission status: Accepted

Solution code:
a = []
a += input()
a *= 2
b = []
b += input()
k = 0
for i in range(len(b)):
    t = []
    for j in range(i, i + len(b)):
        t += a[j]
    if t == b:
        print("Yes")
        k = 1
        break
if k == 0:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def solve():
    S = input()
    T = input()
    b = any([T == (S[i:]+S[:i]) for i in range(len(S))])
    a = 'Yes' if b else 'No'
    return str(a)

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import deque


def rotate(string, n):
    string = deque(string)
    string.rotate(n)
    return "".join(string)


def solve(s, t):
    for i in xrange(len(s)):
        if rotate(t, i) == s:
            return 'Yes'

    return 'No'


s = raw_input()
t = raw_input()
print solve(s, t)

Submission status: Accepted

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

s2=""
f=0
l=len(s)
for i in range(0, len(s)):
    s2+=s[i:l]
    s2+=s[0:i]
    if s2==t:
        f=1
    else:
        s2=""


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

Submission status: Accepted

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

ans = 0

for i in range(len(s)):
    if s == t:
        ans = 1
    else:
        b = s[1:]
        b += s[0]
        s = b

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

Submission status: Accepted

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

def r(s, i):
    return s[-i:] + s[:-i]

for i in range(len(S)):
    if T in r(S, i):
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

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

s = set([s for s in S])
t = set([t for t in T])

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

Submission status: Accepted

Solution code:
n=input()
m=input()
l=''
answer='No'
for i in range (len(n)):
    if n==m:
        answer='Yes'
        break
    m=m[1:]+m[:1]
print(answer)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
  
S = input()
T = input()

if len(S) != len(T):
  print('No')
  exit()

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

print('No')

Submission status: Accepted

Solution code:
# cook your dish here
s=list(input())
t=list(input())
if len(s) == len(t):
    for i in range(0,len(s)):
        s.insert(0,s[-1])
        
        del s[-1]
        
        if s == t:
            print('Yes')
            quit()
        
print('No')

Submission status: Accepted

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

print(judge)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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:
#! usr/bin/env python
# -*- coding: utf-8 -*-


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

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

    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

n = len(s)
ans = "No"
for i in range(n):
    cnt = 0
    for j in range(n):
        if s[j] == t[(i + j) % n]:
            cnt += 1
    if cnt == n:
        ans = "Yes"
        break
print(ans)

Submission status: Accepted

Solution code:
s = str(input())
t = str(input())
flag = False
"""
文字列の回数文だけ回転させる処理をして比較
"""
for i in range(len(s)):
    s = s[len(s)-1] + s[:len(s)-1]
    if s == t:
        flag = True
        break
    else:
        continue

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

Submission status: Accepted

Solution code:
start = input()
goal = input()

first_idx = start.find(goal[0])
id = first_idx
new_str = []
for _ in range(len(start)):
  new_str.append(start[id])
  if id == len(start) - 1:
    id = 0
  else:
    id += 1
new_str = "".join(new_str)
result = 'Yes' if new_str == goal else 'No'
print(result)

Submission status: Accepted

Solution code:
from collections import deque
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

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

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

main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S, T):

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


def main():
    S = read_str()
    T = read_str()
    print(slv(S, T))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

s = input()
t = input()

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

print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
T = input()
flag = False
if len(S) == 2:
    if (S[0] == T[0] and S[1] == T[1]) or (S[0] == T[1] and S[1] == T[0]):
        flag = True

for i in range(1, len(S)-1):
    if S[:i] in T and S[i:] in T:
        flag = True
        break

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

Submission status: Accepted

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

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

for s in range(len(S)):
    if str(S) == str(T):
        print("Yes")
        exit()
    tmp = S.pop(0)
    S.append(tmp)
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
b = input()
l = len(a)
flag = 0
for i in range(l):
    flag2 = 1
    for j in range(l):
        if a[(j+i)%l] != b[j]:
            flag2 = 0
    flag = flag | flag2
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
from sys import stdin
a = stdin.readline().strip()
b = stdin.readline().strip()
ans = 'No'
if a in b + b:
 ans = 'Yes'
print ans

Submission status: Accepted

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

Submission status: Accepted

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

flag = False
n = len(S)

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 21 19:18:37 2018
ABC103B
@author: maezawa
"""

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

ans = 'No'

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

print(ans)

Submission status: Accepted

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

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

else:
    print("No")

Submission status: Accepted

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

for j in range(len(S)):
	for i in range(len(S)):
		if S[i] != T[i]:
			coincide = False
			break
		else :
		    coincide = True
	if coincide :
		break
	T.append(T[0])
	T.pop(0)

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

Submission status: Accepted

Solution code:
s = input()
t = input()
s = list(s)
t = list(t)
num = 0
for i in range(len(s)):
    s.append(s[0])
    s.pop(0)
    if s == t:
        print('Yes')
        num += 1
        break
    else:
        pass
if num == 0:
    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):
    for i in range(len(S)):
        t = S[-i:] + S[:-i]
        #print(S[-i:], S[:-i])
        if t == T:
            return True

    return False


if __name__ == '__main__':
    main()

Submission status: Accepted

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


for i in range(len(S)):
    pre = S[:i]
    lat = S[i:]

    td = lat + pre
    if td == T:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

for i in range(len(S)):
  a = S.pop(0)
  S.append(a)
  if S == T:
    print("Yes")
    k = 1
    break
    
if k == 0:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def cycshift(s) :
    s0 = s[0]
    ss = s[1::]
    return(ss + s0)

p = (s==t)

for i in range(len(s)):
    s = cycshift(s)
    p = (p or s==t)

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

Submission status: Accepted

Solution code:
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s1 = S()
s2 = S()

for i in range(len(s1)):
    rot = s1[i:] + s1[:i]
    if rot == s2:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

def rotate(S, i):
    return S[i:] + S[:i]

ans = any(T == rotate(S, i) for i in range(len(S)))
print('Yes' if ans else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

re = 'No'
n = len(S)
for i in range(n):
    tmp = S[i:n] + S[0:i]
    if tmp == T:
        re = 'Yes'
        break
        
print(re)

Submission status: Accepted

Solution code:
import sys

S = input()
T = input()

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

print("No")

Submission status: Accepted

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

FLAG = False

for i in range(counter):
  r  = ""
  for a in s:
    r += a
  if r == t:
    FLAG = True
    break
  else:
    tmp = s[0]
    s.pop(0)
    s.append(tmp)

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

Submission status: Accepted

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

def match(a, b):
    for i in range(len(a)):
        if a[i:] + a[:i] == b:
            return True

    return False

if match(s, t):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

rotate = lambda R: R[-1]+R[:-1]

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
t = input()
n = len(s)
check = False
for i in range(n):
	temp = True
	counter = 0
	while temp and counter != n:
		if i < n:
			if s[i] != t[counter]:
				temp = False
		else:
			if s[i-n] != t[counter]:
				temp = False
		counter += 1
		i += 1
	if temp:
		check = True
		break
if check:
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
n = len(t)
s = s*2
c = 0
for i in range(2*n):
  if s[i:i+n] == t:
    c += 1
if c >=1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

S = input()
T = input()

def turn(S,T,i):
    return S[i:] + S[:i]


def isOk(S,T):
    for i in range(len(S)):
        if turn(S,T,i) == T:
            print("Yes")
            return
    print("No")

isOk(S,T)

Submission status: Accepted

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

T_copy = list(T + T)
l = len(S)
for i in range(l):
    sub = "".join(T_copy[i:i+l])
    if sub == S:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

'''
same = True
for i in range(len(S)):
    for j in range(len(S)):
        second = i + j
        if second >= len(S):
            second = second - len(S)
            if S[j] != S[second]:
                same = False
        else:
            if S[j] != S[second]:
                same = False

print(same)
'''
same = False
for i in range(len(S)):
    second = ""
    for j in range(len(T)):
        value = i + j
        if value >= len(T):
            value -= len(T)
            second += T[value]
        else:
            second += T[value]
    if S == second:
        same = True
        break

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

Submission status: Accepted

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

def shi(array):
    out = array[-1]+array[:-1]   
    return out

#print(shi(S)
    
for i in range(0,len(S)):
    if S == T:
        print('Yes')
        break
    if i == len(S) - 1:
        print('No')
    T = shi(T)

Submission status: Accepted

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