Problem:


Score : 200 points

Problem Statement

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

Determine if S equals T after rotation.

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

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

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

Constraints

2 \leq |S| \leq 100

|S| = |T|

S and T consist of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

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

Sample Input 1

kyoto
tokyo

Sample Output 1

Yes

In the first operation, kyoto becomes okyot.

In the second operation, okyot becomes tokyo.

Sample Input 2

abc
arc

Sample Output 2

No

abc does not equal arc after any number of operations.

Sample Input 3

aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Sample Output 3

Yes



Sample input:
kyoto
tokyo


Sample output:
Yes

Submission status: Accepted

Solution code:

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

for i in range(len(s)):
    if s == t:
        print("Yes")
        exit()
    else:
        s.insert(0,s[-1])
        del s[-1]

print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
icase=0
if icase==0:
    s=list(input())
    t=list(input())
    lens=len(s)
    for i in range(lens):
        yn=""
        for j in range(lens):
            jj=(i+j)%lens
#            print(i,j,jj,s[j],t[jj])
            if s[j]!=t[jj]:
                yn="No"
                break
        if yn=="No":
            continue
        else:
            yn="Yes"
            break
    if yn=="No" :
        print("No")
    else:
        print("Yes")

Submission status: Accepted

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

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

for i in range(l):
    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)):
    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'
i=0
while i<len(S):
    if S!=T:
        S.append(S.pop(0))
    else:
        ans='Yes'
    i+=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# solution
import io

print("Yes" if input() in input()*2 else "No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S=input()
T=input()
ans=0
for i in range(len(S)):
    S=S[-1]+S[0:-1]
    if T==S:
        ans+=1
        break
    else:
        continue
print('Yes' if ans==1 else '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 = input()
T = input()
tmp = ""
for i in range(len(S) + 1):
  tmp = S[-1]
  S = tmp + S[0:len(S)-1]
  if(S == T):
    print("Yes")
    exit()
print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
if S in T*2:
    print('Yes')
else:
    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:
def myAnswer(S,T):
   init = S[:]
   while True:
      S.append(S.pop(0))
      if(S == T):
         return "Yes"
      elif(init == S):
         return "No"


def modelAnswer():
   tmp=1
def main():
   S = list(input())
   T = list(input())
   print(myAnswer(S[:],T[:]))

if __name__ == '__main__':
   main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

s = ns()
t = ns()

i = 0

while i < 101:
    s = s[-1] + s[:-1]
    if s == t:
        print('Yes')
        exit()
    i += 1
print('No')

Submission status: Accepted

Solution code:
# ABC 103: B – String Rotation
s = input()
t = input()

s_dash = s[-1] + s[:-1]
isExact = 'No'

if s == t:
    isExact = 'Yes'
else:
    while s != s_dash:
        if s_dash == t:
            isExact = 'Yes'
            break
        s_dash = s_dash[-1] + s_dash[:-1]

print(isExact)

Submission status: Accepted

Solution code:
s=input()
t=input()
s+=s
print("Yes" if t in s else "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 = input()
t = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit
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:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

s = list(input())
t = input()
for i in range(len(s)):
    ans = ""
    cnt = 0
    for j in range(-1,len(s)-1):
        ans += s[j]
    res = ""
    for j in range(len(s)):
        s[j] = ans[j]
        res += s[j]
    if res == t:
        print("Yes")
        sys.exit()
print("No")

Submission status: Accepted

Solution code:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
def main():
    s = IS()
    t = IS()
    for i in range(len(s)):
        if t == s[i:] + s[0:i]: print('Yes'); exit(0)
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
D = S*2
flag = 0

for i in range(len(T)):
    for j in range(len(T)):
        if D[i+j] != T[j]:
            break
    else:
        flag = 1

def yn(p):
    if p:
        return "Yes"
    else:
        return "No"
print(yn(flag == 1))

Submission status: Accepted

Solution code:
from collections import deque
S = deque(list(input()))
T = deque(list(input()))

# print('s t', S, T)

for i in range(len(S)):
    if S == T:
        print('Yes')
        exit()
    s = S.pop()
    S.appendleft(s)
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=list(input())
t=list(input())
n=len(s)
for _ in range(n):
        s=[s[n-1]]+s[:n-1]
        if s==t:
            print("Yes")
            break
else:
    print("No")

Submission status: Accepted

Solution code:
print(["No","Yes"][input() in input()*2])

Submission status: Accepted

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

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

s = S[-1] + S[:-1]
while s != S:
    if (s == T):
        print("Yes")
        exit(0)
    s = s[-1] + s[:-1]

print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
t=input()
if s==t:
    print("Yes")

else:
    flag=True
    for i in range(1,len(s)):
        if s[0:i]==t[len(s)-i:len(s)] and s[i:len(s)]==t[0:len(s)-i]:
            print("Yes")
            flag=False
            exit()

    if flag:
        print("No")

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 i in range(len(S)):
    S=list(S[len(S)-1])+S[:len(S)-1]
    if S==T:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
length=len(s)
ans=0

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def rotation(string):
    result = string[-1]
    for i in range(len(string)-1):
        result += string[i]
    return result

S = input()
T = input()

flag = False
for i in range(len(S)):
    S = rotation(S)
    if T == S:
        flag = True
        break

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

Submission status: Accepted

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

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

print('Yes' if S==T else 'No')

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

def lotate(s, i) :
   return(s[i:] + s[:i])

for i in range(len(S)):
  Sl = lotate(S, i)
  if Sl == T :
    print('Yes')
    exit(0)
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
S = str(input())
T = str(input())
ans = 'No'
s = [S[i] for i in range(len(S))]
for i in range(len(S)):
    s.append(S[i])
for i in range(len(S)):
    fr = 0
    for j in range(len(S)):
        if s[i + j] != T[j]:
            fr += 1
            break
    if fr == 0:
        ans = 'Yes'
print(ans)

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:
S = list(input())
T = input()
len_S = len(S)
ans = "No"

for i in range(len_S):
    new_S = ""
    for j in range(i, len_S):
        new_S += S[j]
    for k in range(0, i):
        new_S += S[k]
    if new_S == T:
        ans = "Yes"
        break

print(ans)

Submission status: Accepted

Solution code:
s = input()
t = list(input())
f=len(t)
while(f):
    if s == "".join(t):
        print("Yes")
        break
    else:
        t.append(t.pop(0))
    f-=1
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
S=deque(input())
T=deque(input())
for i in range(len(T)):
  if S==T:
    print("Yes")
    exit()
  t=T.pop()
  T.appendleft(t)
print("No")

Submission status: Accepted

Solution code:
import sys

def resolve():
    S = input()
    T = input()
    allS = []
    for i in range(len(S)):
        allS.append(S[i:]+S[:i])
    if T in allS:
        print("Yes")
    else:
        print("No")

if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
Slist=list(input())
Tlist=list(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
s = input()[:-1]
t = input()[:-1] # 入力が1つ
# map(int, input().split()) # 入力が複数

ans = 'No'
for i in range(len(s)):
    if s == t:
        ans = 'Yes'
        break
    s = s[1:] + s[0]
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()
    else:
        a = s.pop(-1)
        s.insert(0, a)
print("No")

Submission status: Accepted

Solution code:
worda = input()
wordb = input()
for i in range(len(wordb)):
    if worda == wordb[-i:] + wordb[:-i]:
        dst = "Yes"
        break
else:
    dst = "No"
print(dst)

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  s = input()
  t = input()
  cnt = 0
  sl = len(s)
  for i in range(sl):
    s = s[sl-1] + s[:sl-1]
    if s == t:
      print('Yes')
      exit()
  print('No')
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
t = input()
for _ in range(len(t)+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()) 
s = list(S)
t = list(T)
p = 1
for i in range(len(s)):
    if s == t:
        p = p*0
    else:
        p = p*1
    s.insert(0,s[len(s)-1])
    del s[len(s)-1]
if p == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
t = input()
n = len(s)
for i in range(n+1):
    u = s[i:] + s[:i]
    if u == t:
        print('Yes')
        quit()
print('No')

Submission status: Accepted

Solution code:
from collections import deque
def solve():
    S = list(input())
    T = list(input())

    d = deque(S)
    for _ in range(len(S)):
        d.appendleft(d.pop())
        if list(d) == T:
            print('Yes')
            return
    print('No')


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
from collections import deque

s = list(input())
s = deque(s)
n = len(s)
t = input()

for _ in range(n):
    a = s.pop()
    s.appendleft(a)
    ss = "".join(s)
    if ss == t:
        print("Yes")
        exit()
else:
    print("No")

Submission status: Accepted

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

for i in range(len(s)):
    ns = s[i:] + s[:i]
    if(ns == 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:
list_S = list(input())
list_T = list(input())
ans = "No"

for i in range(len(list_S)):
    k = list_S.pop(0)
    list_S.append(k)
    if list_S == list_T:
        ans = "Yes"

print(ans)

Submission status: Accepted

Solution code:
s = input()
t = input()
print("YNeos"[s not in t*3::2])

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(s)):
    s1 = s[:-1 - i]
    s2 = s[-1 - i:]
    test = s2 + s1
    if test == t:
        ans = "Yes"
        break

print(ans)

Submission status: Accepted

Solution code:
def splitmozi(n , s):

    spmozi = ""
    s = list(map(str , s))

    for i in range(len(s)):
        spmozi += s[(-n) + i]

    return spmozi

def String_Rotation(s , t):

    ans = "No"
    for i in range(len(s)):
        spmozi = splitmozi(i , s)
        if spmozi == t:
            ans = "Yes"

    return ans

def main():
    s = str(input())
    t = str(input())
    print(String_Rotation(s , t))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
t = input()
s_list = list(s)
flg = False
for i in range(len(s)):
    s_list.insert(0,s_list[-1])
    del s_list[-1]
    if "".join(s_list) == t:
        print('Yes')
        flg = True
        break
        
if not flg:
    print('No')

Submission status: Accepted

Solution code:
from collections import deque
s = str(input())
t = str(input())
s = deque(s)
t = deque(t)
for i in range(len(s)):
    if s == t:
        print("Yes")
        exit()
    else:
        a = t.popleft()
        t.append(a)
print("No")

Submission status: Accepted

Solution code:

s1 = list(input())
s2 = list(input())
for i in range(len(s1)):
    if s1 == s2:
        print("Yes")
        exit()
    temp = s2[0]
    for j in range(1, len(s1)):
        s2[j - 1] = s2[j]
        if j == len(s2) - 1:
            s2[j] = temp
print("No")

Submission status: Accepted

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

for i in range(n):
    f  = False
    for j in range(n):
        if t[j] == s[(i+j)%n]:
            pass
        else:
            break
    else:
        f = True
        break
if f:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

bool = False
for i in range(len(s)):
    s.appendleft(s[-1])
    s.pop()
    if s == t:
        bool = True
        break
        
print('Yes' if bool else 'No')

Submission status: Accepted

Solution code:
import math

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

ok=False

for i in range(n):
    tmp=True
    for j in range(n):
        if(s[(i+j)%n]!=t[j]):
            tmp=False

    if(tmp):
        ok=True


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

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys

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

Submission status: Accepted

Solution code:


def rolling(str, n):
    return str[n:len(str)] + str[:n]


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

    for i in range(len(S)):
        if rolling(S, i) == T:
            print("Yes")
            exit()

    print("No")


# Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    S = input().strip()
    T = input().strip()
    for i in range(len(S) + 1):
        temp=""
        for j in range(len(S)):
            temp += S[(j+1) % len(S)]
        S=temp
        if T==temp:
            print("Yes")
            return
    print("No")
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
c = 0
for i in range(len(s)):
    p = s.pop()
    s.insert(0, p)
    if s == t:
        c = 1
        break
print("Yes" if c == 1 else "No")

Submission status: Accepted

Solution code:
s=input()
t=input()
a=str()
b=0
c=0
for i in range(len(s)):
    b+=1
    for j in range(len(s)):
        a+=s[j-b]
    if a==t:
        c+=1
    a=str()
if c==0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    T = iss()

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

    print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    T = iss()
    
    print('Yes' if S in T*2 else 'No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
T = input()
S = S * 2
yes = S.find(T) != -1
print('Yes' if yes else 'No')

Submission status: Accepted

Solution code:
from collections import deque

s = deque(input())
t = deque(input())
n=len(s)

yes = False
for _ in range(n):
    if s == t:
        yes = True
        break
    s.rotate()

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

Submission status: Accepted

Solution code:
s=input()
t=input()
flag=False
for _ in range(128):
  s=s[1:]+s[0]
  flag|=(s==t)
print("Yes" if flag else "No")

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

def rolling(x):
    return x[-1] + x[:-1]

cnt = 0
while s != t and cnt < len(s):
    s = rolling(s)
    cnt += 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

    for _ 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:
import sys


def main():
    ss = input()
    ts = input()
    n = len(ss)

    for i in range(n):
        ss = ss[-1] + ss[:-1]
        if ss == ts:
            print('Yes')
            sys.exit(0)

    print("No")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
ans = "No"
def rot(s):
    return s[len(s)-1] + s[0:len(s)-1]
s = rot(S)
while(s != S):
    if (s == T):
        ans = "Yes"
        break
    s = rot(s)

if (s == T):
    ans = "Yes"
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:
from collections import deque

s=deque(input())
t=deque(input())

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

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

print("No")