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 _ in range(len(s)):
    s = s[1:] + s[0]
    if s == t:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

Solution code:
from collections import deque

s = input()
t = input()

t = deque(t)
for i in range(len(s)):
  if s=="".join(t):
    print("Yes")
    exit()
  t.append(t.popleft())
print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
count = 0
ans = "Yes"
while S !=T:
    if count > len(S):
        ans = "No"
        break
    else:
        S = S[-1:] + S[:-1]
        ans = "Yes"
        count +=1
print(ans)

Submission status: Accepted

Solution code:
import sys
s=input()
t=input()
for _ in range(len(s)):
    s=s[1:]+s[0]
    if s==t:
        print('Yes')
        sys.exit()
print('No')

Submission status: Accepted

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

l = len(S)

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

print("No")

Submission status: Accepted

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

S = S + S
print('Yes') if S.find(T) >= 0 else print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    S=input()
    T=input()
    temp=S
    for i in range(len(S)*3):
        temp=temp[-1]+temp[:-1]
        #print(temp)
        if temp==T:print("Yes");return
    print("No")
    #print()
#%%submit!
resolve()

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
    w = s.pop()
    a = s[::-1]
    a.append(w)
    s = a[::-1]
print('Yes' if flag else 'No')

Submission status: Accepted

Solution code:
import fileinput

s = input()
t = input()

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

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

print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
print("Yes" if (s * 2).find(t) >= 0 else "No")

Submission status: Accepted

Solution code:
s = input()
t = input()
ds = s[:]
n = len(s)
turn = 0
while turn != n:
    if s == t:
        print("Yes")
        break
    else:
        s = s[-1] + s[:n-1]
    turn += 1
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#AtCorder Begginer Contest 103 - String Rotation
S=input()
T=input()
flg=0
for i in range(len(T)):
    T=T[-1]+T[:-1]
    if S == T:
        print("Yes")
        break
else:
    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:
S = input()
T = input()
for i in range(len(S)):
    if S == T:
        print("Yes")
        exit()
    else:
        S = S[-1]+S[:-1]
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

for i in range(len(S)):
    if S == T:
        print('Yes')
        sys.exit()
    else:
        tmp = S.pop()
        S.insert(0, tmp)

print('No')

Submission status: Accepted

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

s = list(S)

cnt = 0
jdg = False
while cnt <= len(s):
    p = s.pop()
    s = list(p) + s
    if ''.join(s) == T:
        jdg = True
        break
    cnt += 1
print('Yes' if jdg else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

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

if not match:
    print("No")

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
  
ans = 0
for i in range(len(S)+1):
  if S == T:
    ans = 1
    break
  else:
    S.append(S.pop(0))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools

def solve():
    s = input()
    t = input()
    s = s*3
    if t in s:
        print("Yes")
    else:
        print("No")
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

flag = False

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

Submission status: Accepted

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

ss = s+s
l = len(t)

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

Submission status: Accepted

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


S_ = S
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[:len(s)-1]
    if s == t:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
s = input()
t = input()
c = 0
a_list =[]
while c < len(t):
  a_list.append(t)
  a = t[1:]+t[0:1]
  t = a
  c += 1
if s in a_list:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

n = len(s)

ans = 'No'

for a in range(0, n):
    if s == t:
        ans = 'Yes'
        break
    t = t[1:] + t[0]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    S, T = map(str, open(0).read().split())

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


main()

Submission status: Accepted

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    t = input()
    double = t + t
    print('Yes') if s in double else print('No')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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()
list_S = list(S)

if (len(S) == 1):
    if (S == T):
        print('Yes')
    else:
        print('No')
    
    exit()


def rotate_str(strr):
    n = len(strr)
    rv = strr[1:] + strr[0]
    
    return(rv)


for i in range(len(S)):
    S = rotate_str(S)
    
    if (S == T):
        print('Yes')
        exit()

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
n = str(input())
ans = 0
for i in range(len(s)):
    s = s[1:] + s[0]
    if s == n:
        ans = 1
        break

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

# https://atcoder.jp/contests/abc103
# 11:25-


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

    if S == T:
        return "Yes"

    for i in range(N):
        S = S[-1] + S[:N-1]
        if S == T:
            return "Yes"
    
    return "No"


print(main())

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

s=input().rstrip()
t=input().rstrip()
strs=[]
for i in range(len(s)):
    j=len(s)-i
    ba=s[0:j]
    ba2=s[j:len(s)]
    #print(ba,end=" ")
    #print(ba2,end=" ")
    #fr="".join(list(reversed(s[j:len(s)])))
    #print(fr)
    neu=ba2+ba
    strs.append(neu)
#print(strs)
if t in strs:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
ans = 0
for i in range(len(s)):
    if s == t:
        ans = 1
        break
    a = s.pop(0)
    s.append(a)
if ans == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

for i in range(len(s)):
    tmp = s[-1]
    for j in range(len(s)-1):
        tmp += s[j]
    if tmp == t:
        f = True
        break
    s = tmp

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

Submission status: Accepted

Solution code:
#template
def inputlist(): return [int(k) for k in input().split()]
#template
S = list(input())
T = list(input())
for i in range(len(S)):
    Sa = S[:]
    S = [Sa[-1]] + Sa[:-1]
    if S == T:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
S = input()
T = input()
a = "No"
for i in range(len(S)):
    if S[len(S) - i:] + S[:len(S) - i] == T:
        a = "Yes"
        break
print(a)

Submission status: Accepted

Solution code:
# ABC103B

s = input()
t = input()
n = len(s)
ans = 'No'
for i in range(n):
    #print(f"s = {s}\nt = {t}\n==========")
    if s == t:
        ans = 'Yes'
        break
    s = s[-1] + s[:-1]
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    t=input()
    s+=s
    if t in s:
        print('Yes')
    else:
        print('No')
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

def can():
    for i in range(len(S)):
        U = S[i:] + S[:i]
        if U == T:
            return True
    return False

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

Submission status: Accepted

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

s=input()
t=input()

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

print(ans)

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:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        s=input()
        t=input()
        if s==t:
            return 'Yes'
        else:
            for i in range(1,len(s)+1):
                if s[i:]+s[0:i]==t:
                    return 'Yes'
        return 'No'
    print(main())
resolve()

Submission status: Accepted

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

s += s

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

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

Submission status: Accepted

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

Submission status: Accepted

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


def rotate(s, k):
    n = len(s)
    t = s[k:n]
    t += s[0:k]
    return t


ans = "No"

for i in range(n):
    if rotate(s, i) == t:
        ans = "Yes"

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
import sys
import math

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
length = len(s)
count = 0
for i in range(length):
  newlst = []
  newlst.append(s[length-1])
  for j in range(length-1):
    newlst.append(s[j])
  s = newlst
  if s == t:
    print("Yes")
    count += 1
    exit()
if count == 0:
  print("No")

Submission status: Accepted

Solution code:
s,t = (input() for _ in range(2))
ans ='No'

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

Submission status: Accepted

Solution code:
from collections import deque
s = deque(input())
t = deque(input())
ans = "No"
for i in range(len(s)):
    if s == t:
        ans = "Yes"
        break
    tmp = s.popleft()
    s.append(tmp)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print('Yes' if S in T+T else '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):
    print(YES if any(
        S == T[i:] + T[:i]
        for i in range(len(T))
    ) else 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
    solve(S, T)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
flag=0
for a in range(len(s)+2):
    if s==t:
        print("Yes")
        flag=1
        break
    t.append(t.pop(0))
if flag==0:
    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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

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

Submission status: Accepted

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

s += s
if t in s:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

init_s = s

found = False
while True:
    s = s[-1] + s[:-1]
    if s == t:
        found = True
        break
    if s == init_s:
        break

print('Yes' if found else '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:
s = input()
t = input()

l = len(s)

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

print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
s_lst = [i for i in s]
ans = 0
for i in range(len(s_lst)):
    tmp = s_lst[len(s_lst)-1]
    s_lst.pop()
    a = []
    a.append(tmp)
    for j in s_lst:
        a.append(j)
    s_lst = a
    b = "".join(a)
    if b == t:
        ans += 1
if ans >=1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

for _ in range(len(S)):
    if S == T:
        print('Yes')
        break
    else:
        S = S[-1] + S[:-1]
else:
    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:
# coding:utf-8
s = input()
t = input()


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

print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    S=input()
    T=input()
    for i in range(len(S)):
        if S==T[i:]+T[:i]:
            YesNo(1)
            exit()
    YesNo(0)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
MOD = 10**9+7
INF = float('inf')

def main():
    S = input()
    T = input()
    L = len(S)
    bl = False
    for i in range(L):
        s = S[-i:] + S[:-i]
        if T == s:
            bl = True
    print('Yes' if bl else 'No')





if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
for _ in range(len(s)):
    if s == t:
        print("Yes")
        quit()
    else:
        end = s.pop(0)
        s.append(end)
print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
n = len(s)
for i in range(n):
    s = list(s)
    s_last = [s[n - 1]]
    u = s_last + s[0:n - 1]
    s = "".join(u)
    if s == t:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip()
    t = input().rstrip()

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

if __name__ == '__main__':
    main()

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'
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    T = input()
    L = len(S)
    for i in range(L):
        if S == T[L - i:] + T[:L - i]:
            print('Yes')
            exit()
    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")
        exit()
print("No")

Submission status: Accepted

Solution code:
S1=str(input())
S2=str(input())
NG = True
for i in range(len(S1)):
  if S1 == S2[i:len(S1)]+S2[0:i]:
    print('Yes')
    NG = False
    break
if NG:
  print('No')

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
S = input()
T = input()

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

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

Solution code:
S=input()
T=input()
flg=0
for i in range(len(S)):
    moji=str()
    for j in range(len(S)):
        word=i+j
        if word>=len(S):
            word=i+j-len(S)
        moji+=S[word]
    if moji==T:
        flg=1
        
print("Yes" if flg else "No")

Submission status: Accepted

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

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

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

l = len(S)

for i in range(l):
    count = 0
    for j in range(l):
        if i+j >= l:
            if S[i+j-l] == T[j]:
                count += 1
            else:
                break
        else:
            if S[i+j] == T[j]:
                count += 1
            else:
                break

    if count == l:
        print('Yes')
        exit()

print('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
t = list(S)
ans = 'No'
for i in range(len(S)):
    if ''.join(t) == T:
        ans = 'Yes'
        break
    else:
        tmp = t.pop()
        t.insert(0, tmp)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    S = input()*2
    T = input()
    if T in S:
        print("Yes")
    else:
        print("No")
    return



if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# abc103_b.py
S = input()
T = input()
ans = "No"
for i,c in enumerate(S):
    if T == S[i+1:]+S[:i+1]:
        ans= "Yes"
print(ans)