Problem:


Score : 200 points

Problem Statement

You are given string S and T consisting of lowercase English letters.

Determine if S equals T after rotation.

That is, determine if S equals T after the following operation is performed some number of times:

Operation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.

Here, |X| denotes the length of the string X.

Constraints

2 \leq |S| \leq 100

|S| = |T|

S and T consist of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

If S equals T after rotation, print Yes; if it does not, print No.

Sample Input 1

kyoto
tokyo

Sample Output 1

Yes

In the first operation, kyoto becomes okyot.

In the second operation, okyot becomes tokyo.

Sample Input 2

abc
arc

Sample Output 2

No

abc does not equal arc after any number of operations.

Sample Input 3

aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Sample Output 3

Yes



Sample input:
kyoto
tokyo


Sample output:
Yes

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

Solution code:
S = raw_input()
T = raw_input()
Slist = []
Tlist = []
for i in range(0, len(S)):
	Slist.append(S[i])
	Tlist.append(T[i])
flag = False
for i in range(0, len(S)):
	if Slist == Tlist:
		flag = True
		break
	x = Slist.pop(0)
	Slist.append(x)
if flag: print 'Yes'
else: print 'No'

Submission status: Accepted

Solution code:
S=input()
T=input()
l=[]


for i in range(len(S)):
    l.append(S[i:]+S[:i])
if T in l:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

def solve(S: str, T: str):
    print( YES if T in [ S[i:]+S[:i] for i,s in enumerate(S) ] else NO )

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
s1=s[1:]
for sk in s:
    s1=s1+sk
    if t==s1:
        print("Yes")
        break
    s1=s1[1:]
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

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

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

print("No")

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import copy

S = input()
T = input()

ans = 'No'
for i in range(len(S)):
    u = copy.copy(S)
    S = u[-1]+u[:-1]
    if S == T:
        ans = 'Yes'
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input()
y = input()
b = 0
for i in range(len(x)):
  if x[i:] + x[:i] == y:
    b=1
    break


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

Submission status: Accepted

Solution code:
def rotation(st):
    return st[-1]+st[0:-1]
s = input()
t = input()
flg = 0
tmp_s = s
for _ in range(len(s)):
    tmp_s = rotation(tmp_s)
    if tmp_s ==t:
        print("Yes")
        flg = 1
        break
if flg==0:
    print("No")

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()
check = []
check.append(t[len(t)-1]+t[0:len(t)-1])
for i in range(1, len(t)+1):
    check.append(check[i-1][len(t)-1]+check[i-1][0:len(t)-1])
    if s == check[i-1]:
        print('Yes')
        sys.exit()
print('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 = input()
t = input()
ans = False
for i in range(len(s)):
	if s == t[-i:] + t[:-i]:ans = True
print('Yes' if ans else 'No')

Submission status: Accepted

Solution code:
from sys import stdin

S = stdin.readline().rstrip()
T = stdin.readline().rstrip()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
T = input()
s = len(S)
def hantei():
    for i in range(s):
        p = 0
        for j in range(s):
            if S[(j + i) % s] != T[j]:
                p = 1
        if p == 0:
            return("Yes")
    return("No")

print(hantei())

Submission status: Accepted

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

Submission status: Accepted

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

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

def solve(S: str, T: str):
    ret = NO
    n = len(S)
    for i in range(n):
        for j in range(n):
            if (S[i:n] + S[:i]) == T:
                ret = YES
                break
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
T = input()
ans = False
for i in range(len(S)):
    if list(S) == [list(T)[(i+j)%(len(T))] for j in range(len(T))]:
        ans = True
if ans:
    print('Yes')
if not ans:
    print('No')

Submission status: Accepted

Solution code:
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


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

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

    print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

while S != T:
  S = S[-1] + S[0:-1]
  cnt += 1
  if cnt >= 101:
    break
    
if S == T:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=list(str(input()))
t=list(str(input()))
n=len(s)
f=True
g=False
for i in range(n):
    f = True
    for j in range(n):
        if t[j]==s[(i+j)%n]:
            f = f and True
        else:
            f = False
    if f:
        g = g or f
if g:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python
S = input()
T = input()
N = len(S)
for i in range(N):
    S_r = S[i:] + S[:i]
    if S_r == T:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

prev_T = T
result = 'No'

for i in range(len(T)):

    temp_T = prev_T[-1] + prev_T[0:-1]

    if temp_T == S:
        result = 'Yes'
        break

    prev_T = temp_T

print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import copy

S = input()
T = input()

ans = "No"
S_ = copy.deepcopy(S)
for s in range(len(S)):
    S_ = S_[-1] + S_[:-1]
    if S_ == T:
        ans = "Yes"

print(ans)

Submission status: Accepted

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

    flag = 0

    for i in range(len(s)):
        s = list(s)
        b = s[-1]
        for j in reversed(range(len(s))):
            s[j] = s[j-1]
        s[0] = b
        s = ''.join(s)
        if s == t:
            flag = 1
            break


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

if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def main():
    origin = list(input())
    goal = list(input())
    flg = 0
    for i in range(len(origin)):
        pre = origin[:i]
        aft = origin[i:]
        now_data = aft + pre
        if now_data == goal:
            flg = 1
            break


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




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import copy
s=list(input())
t=list(input())
ans=0
for _ in range(len(s)):
    s.insert(0,s[-1])
    del s[-1:]
    if s==t:
        ans=1
print('Yes' if ans==1 else 'No')

Submission status: Accepted

Solution code:
import sys
def check(i, s, t):
    new_t_list = t[i:] + t[:i]
    if new_t_list == s:
        return True
    else:
        return False

if __name__ == '__main__':
    s = input()
    t = input()
    s_head = s[0]
    for i in range(len(t)):
        if t[i] == s_head:
            b = check(i, s, t)
            if b:
                print("Yes")
                sys.exit()
    print("No")

Submission status: Accepted

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


if __name__ == "__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def lis(n):
    m=[]
    for i in range(len(n)):
        m.append(n[i])
    return(m)


a=input()
b=input()
ans=0
new_list=lis(a)
for k in range(len(a)):
    l=new_list.pop(-1)
    new_list.insert(0,l)
    if new_list==lis(b):
        ans=+1
if ans==0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for _ in S:
    S.insert(0, S[-1])
    del S[-1]
    S_str = "".join(S)
    if S_str == T:
        print("Yes")
        exit(0)
print("No")

Submission status: Accepted

Solution code:
# coding=UTF-8
S=input()
S=list(S)
T=input()
Key=False

for i in range(len(S)):
    S=''.join(S)
    if S==T:
        Key=True
        break
    S=list(S)
    tmp=S[0]
    del S[0]
    S.append(tmp)
    

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

Submission status: Accepted

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

flag=False
for _ in range(len(s)):
    if s==t:
        flag=True
    else:
        tmps=s[0]
        s=s[1::]+tmps

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input();t=input();print('YNeos'[s not in[t[i:]+t[:i]for i in range(len(s))]::2])

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd

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

def solve(S: str, T: str):
    SS = S + S
    for i in range(len(S)):
        if SS[i:i+len(S)] == T:
            return YES
    return NO


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    result = solve(S, T)
    print(result)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
length = len(s)
ans = 'No'
for i in range(length):
    k0 = s[0]
    for j in range(length-1):
        k1 = s[j+1]
        s[j+1] = k0
        k0 = k1       
    s[0] = k0
    #print(s)
    if s == t:
        ans = 'Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=str(input())
t=str(input())
sl=list(s)
tl=list(t)
for i in range(len(s)):
    sl.append(sl.pop(0))
    if sl == tl:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

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

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 = input()
t = input()
ans = "No"
for i in range(len(s)):
    if s[i:] + s[:i] == t:
        ans = "Yes"
print(ans)

Submission status: Accepted

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

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

del(t[-1])
del(s[-1])


for _ in range(len(t)):
    temp = t[-1]

    for i in range(len(t)-1):
        t[-1 - i] = t[-2 - i]
    t[0] = temp

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

print('No')

Submission status: Accepted

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

if S == T:
    print('Yes')
else:
    Flag = True
    for i in range(len(S)):
        if Flag:
            #print(i)
            S = S[1:] + S[0]
            if S == T:
                print('Yes')
                Flag = False
            else:
                if i == len(S) - 1:
                    print('No')
                    Flag = False
                else:
                    continue

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()

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

print('No')

Submission status: Accepted

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

print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ss = input()
ss = ss + ss[0:-1]
if s in ss:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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