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

Submission status: Accepted

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

tt = t + t

if tt.find(s) != -1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
str1 = input()
str2 = input()


result = ""
str_len = len(str1)
for i in range(str_len):
    if((str1[str_len - i:] + str1[0:str_len - i]) == str2):
        result = "Yes"
        break


if(result != "Yes"):
    print("No")
else:
    print(result)

Submission status: Accepted

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

change = ""
ok = 0

for i in range(len(S)):
  if S[0] == T[i]:
    for j in range(len(S) - i):
      change += T[j+i]
    for k in range(i):
      change += T[k]
    if Spr == change:
      if ok == 0:
      	print("Yes")
      	ok = 1
    change = ""

if i == len(S) - 1 and ok == 0:
  print("No")

Submission status: Accepted

Solution code:
input_a = input()
input_b = input()
if input_a == input_b:
    print('Yes')
    exit()

alt_a = input_a
res = False

while True:
    alt_a = alt_a[1:] + alt_a[0]

    if alt_a == input_a:
        break

    if alt_a == input_b:
        res = True
        break

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

Submission status: Accepted

Solution code:
# String Rotation

def main():
    s1 = input()
    s2 = input()

    _s = s2

    for i in range(len(s1)):
        if s1 == _s:
            print("Yes")
            return
        else:
            _s = rotate(_s)
    print("No")
    return

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

length = len(S)

a = []
for i in range(length):
    a.append(S[i])

b = []
for i in range(length):
    b.append(T[i])

c = []
temp = []
for i in range(length):
    if a == b:
        print('Yes')
        break
    else:
        temp = [a[length-1]]
        c = temp + a[0:(length-1)]
        a = c
    if i == length - 1:
        print('No')

Submission status: Accepted

Solution code:
A = raw_input()
B = raw_input()
C = B + B 
if A in C:
  print "Yes"
else:
  print "No"

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
S = input()
T = input()
q = deque(list(S))
OK = False
for i in range(len(S)):
    last = q[-1]
    q.pop()
    q.appendleft(last)
    ans = list(q)
    ans = ''.join(ans)
    #print (ans)
    if ans == T:
        print ("Yes")
        OK = True
        break
if OK == False:
    print ("No")

Submission status: Accepted

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

  if len(S) != len(T) or False in [ S.count(s) == T.count(s) for s in list(set(S))]:
    print("No")
    return
  i = 0
  lim = len(T)
  while i < lim:
    S = S[-1] + S[0:-1]
    if S == T:
      print("Yes")
      return
    i += 1
    
  print("No")

check()

Submission status: Accepted

Solution code:
def run(s, t):
    len_t = len(t)
    for i in range(len_t):
        t = t[-1] + t[0:(len_t-1)]
        if s == t:
            return 'Yes'
    return 'No'


def read_line():
    s = input()
    t = input()
    return (s, t)


def main():
    s, t = read_line()
    ret = run(s, t)
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
T = input()
c = dict()
T2 = list(T)
f = False
start = 1
end = len(S) -1
for i in list(reversed(range(len(S)))):
    S = S[len(S)-1] + S[0:len(S)-1]
    if T == S:
        print("Yes")
        f = True
        break
if f == False:
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
s = s * 2
t = t * 2
f = 0
for i in range(0,int(len(s) / 2)):
 frag = 1
 for j in range(0,int(len(s) / 2)):
  if s[j] != t[i + j]:
   frag = 0
 if frag == 1:
  f = 1
if f == 1:
 print("Yes")
else:
 print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#coding: utf-8

def checkStr():
    sA = s1
    for i in range(len(s1)):
        sA = sA[len(s1) - 1:len(s1)] + sA[0:len(s1) - 1]
        if sA == s2:
            return True
    return False

s1 = input()
s2 = input()
if checkStr():
    print ("Yes")
else:
    print ("No")

Submission status: Accepted

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

Length = int(len(S))
counter = Length-1
Answer = 'No'
while counter >= 0:
    S = S[Length - 1] + S
    S = S[:-1]
    if S == T:
        Answer = 'Yes'
    counter -=1
print(Answer)

Submission status: Accepted

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

    if is_match_swith_rotation(s, t):
        print('Yes')
    else:
        print('No')

def is_match_swith_rotation(s, t):
    if t in s + s:
        return True
    else:
        return False

main()

Submission status: Accepted

Solution code:
a = input()
b = input()
n = len(a)
b *= 2
for i in range(0, n):
	if b[i:(i + n)] == a:
		print('Yes')
		exit(0)
print('No')

Submission status: Accepted

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

success = False
for _l in range(len(s)):
    if ''.join(s) == a:
        success = True
        break
    s.insert(0, s.pop())

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

Submission status: Accepted

Solution code:

s = input()
t = input()

l = list(s)

for i in range(len(t)):
    if(''.join(l)  == t):
        print('Yes')
        exit()
    u = ''.join(l)
#    print(u)
    l = list(u)
    l.insert(0, l.pop())
    
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

for i in range(len(s)):    
    if s == t:
        break

    tmp = s.pop(len(s)-1)
    s.insert(0, tmp)

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 'No'
for i in range(len(S)):
	T = T[len(T)-1:len(T)] + T[0:len(T)-1]

	if S == T:
		ans = 'Yes'
		break

print(ans)

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
counter = 0
hey = ""
while len(s) > counter:
    if s == t:
        hey = "yes"
        break
    else:
        hey = s[len(s)-1]
        s.pop(len(s)-1)
        s.insert(0,hey)
    counter += 1
if hey == "yes":
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
flag = False
for i in range(len(s)):
	if s == t:
		flag = True
		break
	s = s[len(s)-1:] + s[:-1]


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

Submission status: Accepted

Solution code:
S = tuple(input()) # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if word == T:
        print('Yes')
        break
    elif i == j:
        print('No')
        break

Submission status: Accepted

Solution code:
S = input()

T = input()
#print(S[0:len(S)])
i = 0
flag = False
while flag == False and i <= len(S):
    #print(S[0:len(S) - i],S[len(S) - i:len(S)],T[0:i],T[0+i:len(T)])
    if S[0:len(S) - i] == T[0+i:len(T)]:
        if S[len(S) - i:len(S)] == T[0:i]:
            flag = True
            break

    i += 1

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

Submission status: Accepted

Solution code:
from collections import deque

s = input()
t = input()

s_deque = deque(s)
t_deque = deque(t)

content = "No"
for i in range(len(s)):
    s_deque.rotate(1)
    if s_deque == t_deque:
        content = "Yes"
        break

print(content)

Submission status: Accepted

Solution code:
write_1 = input()
write_2 = input()

word = write_2
lis = []

judge = 0

for n in (write_2):
    lis.append(n)


for i in range(len(write_2)):
    a = lis.pop(0)
    lis.append(a)
    if write_1 == "".join(lis):
        judge += 1

print("Yes" if judge >= 1 else "No")

Submission status: Accepted

Solution code:
# B - String Rotation
# https://beta.atcoder.jp/contests/abc103/tasks/abc103_b

# B_String_Rotation_2.py

S = input()
T = input()

def judge(S,T):
    length = len(S)
    if length != len(T):
        return "No"
    else:
        for i in range(0, length):
            S_rotated = S[length-i:] + S[:length-i]
            if S_rotated == T:
                return "Yes"
        return "No"
print(judge(S,T))

Submission status: Accepted

Solution code:
def solve():
	S = raw_input()
	T = raw_input()
	for i in range(len(S)):
		lot_S = S[i:len(S)] + S[0:i]
		if lot_S == T:
			return True

	return False

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

Submission status: Accepted

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

n = s.count(t[0])
for i in range(n):
  i = s.rfind(t[0])
  st = s[:i], s[i:]
  s = st[1] + st[0]
  if s == t:
    print('Yes')
    sys.exit()
print('No')

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[:1]

print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy

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

tmp = s[:]
for i in range(len(tmp)):
    tmp = numpy.roll(tmp, 1)
    if ''.join(tmp) == t:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
s = list(S)
t = list(T)
match = False
for rotation in range(len(s)):
    flag = 0
    for i in range(len(s)):
        if i+rotation > len(s)-1:
            count = i+rotation-len(s)
        else:
            count = i+rotation
        if s[count] == t[i]:
            pass
        else:
            flag = 1
    if flag == 0:
        match = True
if match == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
def main():
	A = input()
	A_list = list(A)
	B = input()
	B_list = list(B)
	B_com = B_list + B_list
	l1 = len(A)
	l2 = len(A * 2)

	i = 0
	num = []
	for c in B_list:
		if A_list[0] == c:
			num.append(i)
			i += 1
		else:
			i += 1

	if len(num) == 0:
		print('No')
	else:
		for j in num:
			check = 0
			for k in range(l1):
				if A_list[k] == B_com[j + k]:
					check += 0
				else:
					check += 1
			if check == 0:
				print('Yes')
				break
			else:
				check = -1
		if check == -1:
			print('No')

 
if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
S = input()
T = input()
u = len(S)-1
k = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

if s == t:
    print("Yes")
else:
    for i in range(len(t)):
        # 末尾を削除して先頭に追加
        temp = t.pop(-1)
        t.insert(0, temp)
        if s == t:
            print("Yes")
            break
    else:
        print("No")

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()


if s == t:
    print("Yes")
    sys.exit(0)

ls = list(s)
for i in range(0,len(s)):
    tmp = ls.pop(-1)
    ls.insert(0,tmp)

    sls = ''.join(ls)
    #print(t, sls)

    if t == str(sls):
        print("Yes")
        sys,exit(0)
    else:
        continue

print("No")

Submission status: Accepted

Solution code:
def rotation(string, leng):
	return string[-1] + string[0:leng - 1]

def judge(a, b, leng):
	for _ in range(leng):
		if a == b:
			return 1
		else:
			b = rotation(b, leng)
	return 0

def run():
	A = input()
	B = input()
	leng = len(A)

	if leng == len(B) and judge(A, B, leng):
		print('Yes')

	else:
		print('No')

if __name__ == '__main__':
	run()

Submission status: Accepted

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

str=list(s)
ans='No'
for i in range(len(s)):
    if str == t:
        ans='Yes'
        break
    str.insert(0,str.pop(-1))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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


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

    print("No")

if __name__ == "__main__":
        main()

Submission status: Accepted

Solution code:
si = input()
q = input()
si2 = si*2
test = []
for i in range(len(si)):
    test.append(si2[i:i+len(si)])

if q in test:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

s = len(S)

for i in range(s):
    if( S == T ): break
    S = S[1:] + S[0]

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

Submission status: Accepted

Solution code:
a = list(input())
b = list(input())
i = 0
for i in range(100):
    if a != b:
        a.append(a[0])
        a.pop(0)
        i += 1
    elif a == b:
        print("Yes")
        break
if a != b:
    print("No")

Submission status: Accepted

Solution code:
import sys
s=raw_input()
t=raw_input()
l=len(s)
for i in xrange(l):
  u=""
  for j in xrange(l):
    u+=s[(i+j)%l]
  if u == t:
    print "Yes"
    sys.exit()
print "No"

Submission status: Accepted

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

if(len(s) != len(t)):
    print("No")
else:
    for i in range(len(s)):
        str = ''.join(s)
        if(str == t):
            print("Yes")
            exit()
        u = s.pop(0)
        s.append(u)
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
        run()

def run():
        word = input()
        word = list(word)
        target = input()
        isSame = False
        for _ in range(len(word)):
                word_string = "".join(word)
                if word_string == target:
                        isSame = True
                        break
                rotate_char = word.pop(0)
                word.append(rotate_char)
        if isSame:
                print("Yes")
        else:
                print("No")

if __name__ == "__main__":
        main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2018/7/21 20:19
# @Version : 1.1
# @Author  : Jade
# @File    : acm.py
# @Software: PyCharm
#
s = input()
t = input()

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

Submission status: Accepted

Solution code:
S = input()

T = input()

flag = 0


def judge(n):
    i = 0
    while S[i] == T[(i+n) % len(S)] :
#        print(S[i],T[(i+n) % len(S)])
        i += 1
        if i == len(S):
            print("Yes")
            return 1
            break
    return 0

for i in range(len(S)):
    j = judge(i)
    if j == 1:
        break

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

while result == 0 and n < N:
    if S == T:
        result = 1
    else:
        S = S[1:N] + [S[0]]
        n += 1
        
if result == 0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

S = list(input())
T = list(input())
Flag=0
for i in range(len(S)):
    K=[]
    L = S[0:len(S)-(i+1)]
    K = S[len(S)-i-1:]
    K = K+L
    #print(K)
    if (K)==T:
        print("Yes")
        Flag=1
        break;
if Flag==0:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

s1 = input()
s2 = input()
f = 0

for i in range(len(s1)):
    s = s1[i:len(s1)] + s1[0:i]
    if s == s2:
        f = 1
        break
if f == 1:
    print("Yes")
elif f == 0:
    print("No")

Submission status: Accepted

Solution code:
# your code goes here
s1 = input()
s2 = input()
n = len(s1)
flag = 0
for i in range(n):
	if(s1 == s2):
		flag = 1
	else:
		s2 = s2[-1]+s2[:-1]
		#print(s2)
if(flag == 1):
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
import sys

a = input()
b = input()

for i in range(len(a)):
    temp = a[:1]
    a = a[1:]
    a = a+temp
    if a == b:
        print("Yes")
        sys.exit()

print("No")

Submission status: Accepted

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

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

    if s_ == t:
        print('Yes')
        exit()

    s = s_

print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()

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

Submission status: Accepted

Solution code:
a=input()
b=input()
z=len(a)
for i in range(0,z):
  if a==b[i:]+b[:i] : 
    print("Yes")
    exit(0)
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(S)
print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
a = []
b = []
for i in s:
    a.append(i)
for j in t:
    b.append(j)


flag = False
for i in range(len(a) + 1):
    if a == b:
        flag = True
        break
    else:
        p =  b[0]
        b.pop(0)
        b.append(p)

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

Submission status: Accepted

Solution code:
import sys

S = input()
T = input()

Sc = list(S)
Tc = list(T)

Sl = len(Sc)
newSc = Sc

for i in range(Sl):
    newSc = newSc[(Sl - 1):] + newSc[:(Sl - 1)]
    if Tc == newSc:
        print('Yes')
        sys.exit()

print('No')

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

n=len(a)
f=-1

for i in range(n):
    for k in range(n):
        if not a[k]==b[k]:
            break
    else:
        f=1
        break
    if f<0:
        tmp=['0']*n
        tmp[0]=b[n-1]
        for j in range(1,n):
            tmp[j]=b[j-1]
        for k in range(n):
            b[k]=tmp[k]

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

Submission status: Accepted

Solution code:
ins1 = input()
ins2 = input()
length = len(ins1)
ans = False
for i in range(0,length):
	ins1=ins1[length-1]+ins1
	if ins1[0:length] == ins2 :
		ans = True
if ans:
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

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

ans=False

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

Submission status: Accepted

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

if not len(s_li) == len(t_li) :
    print("No")
    exit()

buf = s_li

for i in range(len(s_li)):
    s_join = "".join(s_li)
    buf = []
    if t == s_join:
        print("Yes")
        exit()
    for j in range(len(s_li)):
        if j == 0 :
            buf.append(s_li[len(s_li) - 1])
        else :
            buf.append(s_li[j - 1])
    s_li = buf

print("No")

Submission status: Accepted

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

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

    else:
        print('Yes')
        break

else:
    print('No')

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def f(S):
    sets = {}
    for s in S:
        sets[s] = sets.setdefault(s, 0) + 1
    return sets
S = input()
T = input()
setS = f(S)
setT = f(T)

for k, v in setS.items():
    if setT.setdefault(k, 0) != v:
        print("No")
        break
else:
    N = len(S)
    for n in range(N):
        if S == T:
            print("Yes")
            break
        S = S[N-1] + S[0:N-1]
    else:
        print("No")

Submission status: Accepted

Solution code:
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    S = read_func().strip()
    T = read_func().strip()

    for i in range(len(T)):
        is_match = True
        for j in range(len(S)):
            if S[j] != T[(i + j) % len(T)]:
                is_match = False
                break
        if is_match == True:
            break;
    if is_match == True:
        print "Yes"
    else:
        print "No"

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

n = input()
m = input()

d = {}

flag = False

for i in range(len(n)):
    if n[i:]+n[:i] == m:
        flag = True

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

Submission status: Accepted

Solution code:
inp = raw_input()
test = raw_input()

inp2 = inp * 2

if test in inp2:
    print 'Yes'
else:
    print 'No'

Submission status: Accepted

Solution code:
s = list(input())
l = list(input())
num = len(s)

for i in range(num):
    if s == l:
        print("Yes")
        exit()
    tmp = s[1:]
    tmp.append(s[0])
    s = tmp
print("No")

Submission status: Accepted

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

ary_s = []
ary_t = []

for i in s:
    ary_s.append(i)
for i in t:
    ary_t.append(i)

copy = list(ary_s)

if ary_s == ary_t:
    print("Yes")
else:
    while(True):
        tmp = ary_s[-1]
        ary_s.insert(0,tmp)
        ary_s.pop(-1)
        if ary_s == ary_t:
            print("Yes")
            break
        if ary_s == copy:
            print("No")
            break

Submission status: Accepted

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

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

a=int(1)

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

if a==1:
    print('No')

Submission status: Accepted

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


def check(s,t):
    ns = len(s)
    nt = len(t)
    bool = 0

    if ns != nt:
        pass
    else:
        for i in range(ns):
            st = t[i:] + t[:i]
            if s == st:
                bool = 1
            else:
                pass

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

for i in range(len(S)):
    tmp = []
    tmp.extend(S[-i:])
    tmp.extend(S[0:-i])
    # print(tmp)
    if tmp == T:
        print('Yes')
        exit()

print('No')

Submission status: Accepted

Solution code:
def get_score(s, t):
    for i in range(len(s)):
        s = s[-1:] + s[:len(s) - 1]
        if s == t:
            return True
    return False


a = input()
b = input()

r = 'Yes' if get_score(a, b) else 'No'
print(r)

Submission status: Accepted

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

flag = 0
for i in range(n):
    if s==t: flag = 1; break
    s = s[n-1]+s[:n-1]

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

Submission status: Accepted

Solution code:
a=input()
b=input()
b=list(b)
n=len(a)
flag=0
for i in range(0,n):
    a=list(a)
    c=a[n-1]
    a=a[0:n-1]
    a.insert(0,c)
    #a=str(a)
    #print(a)
    if a==b:
        flag=1
        break
if flag==0:
    print('No')
else:
    print("Yes")

Submission status: Accepted

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

if (S + S).find(T) != -1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()

if s == t:
    print('Yes')
    sys.exit(0)

if sorted(s) != sorted(t):
    print('No')
    sys.exit(0)

can = False
n = len(s)
for i in range(1, n):
    if s[i:] == t[:n-i]:
        if s[:i] == t[n-i:]:
            can = True
            break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
t = str(input())
s_list = list(s)
t_list = list(t)
index = len(s_list)-1
ans=''
for i in range(len(s_list)):
    s_list = [s_list[index]] + s_list[0:index]
    if s_list == t_list and ans == '':
        print('Yes')
        ans = 'yes'
if ans == '':
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
LS=list(S)
LT=list(T)
N=len(LS) 
flag = -1
for i in range(N):
  X=LS.pop()
  LS.insert(0,X)
  if LS==LT:
    flag = 1
if flag == 1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

is_equal = False

for i in range(len(s)):
    s = s[1:] + s[0]
    if s == t:
        is_equal = True
        break

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

Submission status: Accepted

Solution code:
def main():
    s = raw_input()
    t = raw_input()

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

Submission status: Accepted

Solution code:
S = input()
T = input()
lst = []
num = len(S)
for i in range(num):
    R = S[0:i]
    Q = S[i:num]
    U = Q + R
    lst.append(U)
ans = lst.count(T)
if ans == 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

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

else:
	ans="No"

print(ans)

Submission status: Accepted

Solution code:
candidate = []
S = input()
T = input()
L = list(S)
for i in range(len(S)) :
    a = L[0]
    L.pop(0)
    L.append(a)
    b = ''.join(L)
    candidate.append(b)

if T in candidate :
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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