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:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    
    s = input()
    ss = s + s 
    t = input()
    flag = False
    

    for i in range(len(s)):

        count = 0
        for j in range(len(s)):
            if t[j] == ss[i + j]:
                count += 1
        if count == len(s):
            flag = True

    if flag:
        print("Yes")
    else:
        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=input()
t=input()
if s==t:
    print('Yes')
    exit()
u=s
for c in s[::-1]:
    u=c+u[:-1]
    if u==t:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
res = 'No'
if S == T:
  res='Yes'
count = len(S)
l = len(S)
while S != T and count > -1:
  count -= 1
  s = S[ l -1 ] + S[:(l-1)]
  S =s
 
  if S == T:
    res = 'Yes'
    break
print(res)

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
flag=0
if s==t:
    flag=1
for i in range(len(s)):
    s.insert(0,s[-1])
    s.pop(-1)
    if s==t:
        flag=1
if flag==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[N-1] + S[:N-1]
    if S == T:
        print("Yes")
        break
else: print("No")

Submission status: Accepted

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


flag = True

for i in range(len(s)):
    s.insert(0,s.pop(-1))
    if "".join(s) == "".join(t):
        print("Yes")
        flag = False
        break



if flag:
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
#sを二回並べる
s += s
#sを二回並べた中にtがあれば、回転でいつかたどり着ける。
if(t in s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def resolve():
    S = input().strip()
    T = input().strip()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from collections import deque
import sys
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

S = input()
T = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

def main():
    s = input()
    t = input()
    #n,m = map(int, input().split())
    #a = list(map(int,input().split()))
    l = len(s)
    bool = False
    for i in range(l):
        s = s[l-1]+s[:l-1]
        if s == t:
            bool = True
            break
    if bool == True:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

rev_s = ""
flag = 0

for i in range(len(t)):
    t = t[-1] + t[:len(t)-1]
    # print(t)

    if s == t:
        flag  = 1
        break
    else:
        flag  = 0

if flag == 1:
    print("Yes")
else:
    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()
N = len(S)
V = ["" for i in range(N)]
for i in range(N):
  for j in range(N):
    V[i] = V[i][:] + S[(i+j)%N]
flg = False
for i in range(N):
  if V[i] == T:
    flg = True
if flg:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

# In[1]:


S = input()
T = input()


# In[4]:


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


# In[ ]:

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    S = str(input())
    T = str(input())
    cnt = 0
    while True:
        S = S[-1] + S[:-1]
        cnt += 1
        if S == T:
            print('Yes')
            break
        if cnt > len(S):
            print('No')
            break
    return
resolve()

Submission status: Accepted

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

for i in range(len(s)-1, -1, -1):
    rotated = s[i:] + s[:i]
    if rotated == 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 T==S:
        print('Yes')
        exit()

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 T==S:
        print('Yes')
        sys.exit()

print('No')

Submission status: Accepted

Solution code:
import sys,bisect,string,math,time,functools,random,fractions
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
rep=range
def Golf():n,*t=map(int,open(0).read().split())
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def MI():return map(int,input().split())
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def RA():return map(int,open(0).read().split())
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in range(V)]
    FromStdin=True if ls==None else False
    for i in range(E):
        if FromStdin:
            inp=LI()
            org_inp.append(inp)
        else:
            inp=ls[i]
        if len(inp)==2:
            a,b=inp;c=1
        else:
            a,b,c=inp
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1):
    #h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def accum(ls):
    rt=[0]
    for i in ls:rt+=[rt[-1]+i]
    return rt
def bit_combination(n,base=2):
    rt=[]
    for tb in range(base**n):s=[tb//(base**bt)%base for bt in range(n)];rt+=[s]
    return rt
def gcd(x,y):
    if y==0:return x
    if x%y==0:return y
    while x%y!=0:x,y=y,x%y
    return y
def YN(x):print(['NO','YES'][x])
def Yn(x):print(['No','Yes'][x])
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

mo=10**9+7
inf=float('inf')
FourNb=[(-1,0),(1,0),(0,1),(0,-1)];EightNb=[(-1,0),(1,0),(0,1),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)];compas=dict(zip('WENS',FourNb));cursol=dict(zip('LRUD',FourNb))
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
input=lambda: sys.stdin.readline().rstrip()

class Tree:
    def __init__(self,inp_size=None,ls=None,init=True,index=1):
        self.LCA_init_stat=False
        self.ETtable=[]
        if init:
            if ls==None:
                self.stdin(inp_size,index=index)
            else:
                self.size=len(ls)+1
                self.edges,_=GI(self.size,self.size-1,ls,index=index)
        return
 
    def stdin(self,inp_size=None,index=1):
        if inp_size==None:
            self.size=int(input())
        else:
            self.size=inp_size
        self.edges,_=GI(self.size,self.size-1,index=index)
        return
    
    def listin(self,ls,index=0):
        self.size=len(ls)+1
        self.edges,_=GI(self.size,self.size-1,ls,index=index)
        return
 
    def dfs(self,x,func=lambda pr,prv,nx,dist:prv+dist,root_v=0):
        q=deque([x])
        v=[None]*self.size
        v[x]=root_v
        while q:
            c=q.pop()
            for nb,d in self.edges[c]:
                if v[nb]==None:
                    q.append(nb)
                    v[nb]=func(c,v[c],nb,d)
        return v
 
    def bfs(self,x,func=lambda pr,prv,nx,dist:prv+dist,root_v=0):
        q=deque([x])
        v=[None]*self.size
        v[x]=root_v
        while q:
            c=q.popleft()
            for nb,d in self.edges[c]:
                if v[nb]==None:
                    q.append(nb)
                    v[nb]=func(c,v[c],nb,d)
        return v
 
    def parent(self,x):
        return self.dfs(0,func=lambda pr,prv,nx,dist:pr,root_v=-1)
 
    def topological_sort(self,x):  # return topological sort of the tree
        tps=[]
        q=deque([x])
        v=[None]*self.size
        v[x]=0
        while q:
            c=q.popleft()
            tps.append(c)
            for nb,d in self.edges[c]:
                if v[nb]==None:
                    q.append(nb)
                    v[nb]=0
        return tps
 
    def EulerTour(self,x):
        q=deque()
        q.append(x)
        self.depth=[None]*self.size
        self.depth[x]=0
        self.ETtable=[]
        self.ETdepth=[]
        self.ETin=[-1]*self.size
        self.ETout=[-1]*self.size
        cnt=0
        while q:
            c=q.pop()
            if c<0:
                ce=~c
            else:
                ce=c
                for nb,d in self.edges[ce]:
                    if self.depth[nb]==None:
                        q.append(~ce)
                        q.append(nb)
                        self.depth[nb]=self.depth[ce]+1
            self.ETtable.append(ce)
            self.ETdepth.append(self.depth[ce])
            if self.ETin[ce]==-1:
                self.ETin[ce]=cnt
            else:
                self.ETout[ce]=cnt
            cnt+=1
        return
    
    def LCA_init(self,root):
        self.EulerTour(root)
        self.st=SparseTable(self.ETdepth,init_func=min,init_idl=inf)
        #self.st=SegTree(self.size*2-1,self.ETdepth,function=min,ide=inf)
        self.LCA_init_stat=True
        return
    
    def LCA(self,root,x,y):
        if self.LCA_init_stat==False:
            self.LCA_init(root)
        xin,xout=self.ETin[x],self.ETout[x]
        yin,yout=self.ETin[y],self.ETout[y]
        a=min(xin,yin)
        b=max(xout,yout,xin,yin)
        id_of_min_dep_in_et=self.st.query_id(a,b+1)
        return self.ETtable[id_of_min_dep_in_et]
 
    def __str__(self):
        return  str(self.edges)
 
    def show(self):
        if all([all([d==1 for nd,d in edge]) for edge in self.edges]):
            print( [[nd for nd,d in edge] for edge in self.edges] )
        else:
            print(self)
 
class SparseTable: # O(N log N) for init, O(1) for query(l,r)
    def __init__(self,ls,init_func=min,init_idl=float('inf')):
        self.func=init_func
        self.idl=init_idl
        self.size=len(ls)
        self.N0=self.size.bit_length()
        self.table=[ls[:]]
        self.index=[list(range(self.size))]
        self.lg=[0]*(self.size+1)
        
        for i in range(2,self.size+1):
            self.lg[i]=self.lg[i>>1]+1
 
        for i in range(self.N0):
            tmp=[self.func(self.table[i][j],self.table[i][min(j+(1<<i),self.size-1)]) for j in range(self.size)]
            tmp_id=[self.index[i][j] if self.table[i][j]==self.func(self.table[i][j],self.table[i][min(j+(1<<i),self.size-1)]) else self.index[i][min(j+(1<<i),self.size-1)] for j in range(self.size)]
            self.table+=[tmp]
            self.index+=[tmp_id]
    
    # return func of [l,r)
    def query(self,l,r):
        if r>self.size:r=self.size
        #N=(r-l).bit_length()-1
        N=self.lg[r-l]
        return self.func(self.table[N][l],self.table[N][max(0,r-(1<<N))])
    
    # return index of which val[i] = func of v among [l,r)
    def query_id(self,l,r):
        if r>self.size:r=self.size
        #N=(r-l).bit_length()-1
        N=self.lg[r-l]
        a,b=self.index[N][l],self.index[N][max(0,r-(1<<N))]
        if self.table[0][a]==self.func(self.table[N][l],self.table[N][max(0,r-(1<<N))]):
            b=a
        return b
    
    # return boundary index of r such that func({table[i]} =< x , i in [pos,r]
    def right_bound(self,pos,x):
        k=(self.size-pos).bit_length()
        for j in range(k)[::-1]:
            nx=pos+(1<<j)
            if nx<n and self.query(pos,nx+1)<=x:
                pos+=(1<<j)
        return pos
    
    # return boundary index of l such that func({table[i]} =< x , i in [l,pos]
    def left_bound(self,pos,x):
        k=pos.bit_length()
        for j in range(k)[::-1]:
            nx=pos-(1<<j)
            if 0<=nx and self.query(nx,pos+1)<=x:
                pos-=(1<<j)
        return pos
 
    def __str__(self):
        return str(self.table[0])
 
    def print(self):
        for i in self.table:
            print(*i)
 
show_flg=False
show_flg=True
ans=0

s=S_()
t=S_()
for i in rep(len(s)):
    if s[i:]+s[:i]==t:
        Yn(1)
        exit()
Yn(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def mi():
    return map(int, input().split())

def ii():
    return int(input())

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
	S = deque(SI())
	T = deque(SI())
	for i in range(len(S)):
		S.rotate(1)
		if T == S:
			print('Yes')
			exit()
	print('No')



if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
A=input()
B=input()
if A in B*3:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s=input()
t=input()
c=0
for i in range(len(s)):
    if s[i:]+s[0:i]==t:
        c+=1
        break
if c>0:
    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
    S = S[-1] + S[:-1]
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from collections import deque
from collections import defaultdict

import itertools as it

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

s = input()
t = input()

s+=s

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

Submission status: Accepted

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

Submission status: Accepted

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

def rote(st):
  return st[1:]+st[0]
ans="No"
for i in range(len(s)):
  if s==t:
    ans="Yes"
    break
  t=rote(t)

  
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()
    else:
        pass
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
if s==t:
  print("Yes")
  exit()
l=len(s)  
a=s.copy()
for i in range(l):
  a.append(a[0])
  del a[0]
  if a==t:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)
T = input()
S += S
A = [''.join(S[i:i+N]) for i in range(N)]
if T in A:
    print('Yes')
else:
    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()

ans = "No"

for _ in range(len(S)):
    if S == T:
        ans = "Yes"
    S = S[1:] + S[:1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S=list(str(input()))
T=list(str(input()))
for i in range(len(S)):
  if S==T:
    print('Yes')
    exit()
  a=S.pop(-1)
  S.insert(0,a)
print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc103/tasks/abc103_b
S = input()
T = input()
S += S

print('Yes' if S.count(T) else 'No')

Submission status: Accepted

Solution code:
S = input()
T = input()
s = []
t = []
for i in range(len(S)):
  s.append(S[i])
  t.append(T[i])
flag = 0
if s == t:
  print("Yes")
  flag += 1
else:
  for i in range(len(s)):
    A = s[0]
    s.remove(A)
    s.append(A)
    if s == 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[:i]==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[0]
    if S == T:
        print('Yes')
        exit()
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)
  else:
    S=s
print('No')

Submission status: Accepted

Solution code:
S = list(input())
T = input()
l = len(S)
s = S
for i in range(l):
    li = []
    li.append(s[-1])
    li.extend(s[0:-1])
    moji = ''.join(li)
    if moji == T:
        print('Yes')
        exit()
    s = moji
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

frag='No'
for i in range(len(s)):
  st=s[-i:]+s[:-i]
  if st==t:
    frag='Yes'
    break

print(frag)

Submission status: Accepted

Solution code:
S = list(str(input()))
T = list(str(input()))
ans = 'No'
if S == T:
  ans = 'Yes'
else:
  for i in range(len(T)):
    s = S.pop()
    S = [s] + S
    if S == T:
      ans = 'Yes'

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

s = S()
t = 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:
from collections import deque
S = input()
T = input()

s = deque(list(S))
t = deque(list(T))

n = len(s)
for i in range(n):
    if t == s:
        print("Yes")
        break
    a = t.popleft()
    t.append(a)
else:
    print("No")

Submission status: Accepted

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

flag = 0

for i in range(len(S)):
	S2 = S[-2:]
	S2 = S[-1] + S[:-1]
	if S2 == T:
		flag = 1
	S = S2
	#print(S2)

if flag == 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
  S = S[-1]+S[:-1]
else:
  print('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
s1 = S
while True:
  if s1 == T:
    print('Yes')
    exit()
  s1 = s1[-1]+s1[:-1]
  if s1 == S:
    print('No')
    exit()

Submission status: Accepted

Solution code:
S = input()
T = input()
s1 = S
while True:
  if s1 == T:
    print('Yes')
    exit()
  s1 = s1[-1]+s1[:-1]
  if s1 == S:
    print('No')
    exit()
  if s1 == T:
    print('Yes')
    exit()

Submission status: Accepted

Solution code:
S=input()
T=input()
for i 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)):
  s = s[-1] + s[0:-1]
  if s == 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)):
    s = S.pop(len(S)-1)
    S.insert(0, s)
    if S == T:
        ans = 'Yes'
        break
print(ans)

Submission status: Accepted

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

for _ in range(len(s)):
    if "".join(s) == t:
        ans = "Yes"
        break
    else:
        last_s = s.pop(-1)
        s.insert(0, last_s)
print(ans)

Submission status: Accepted

Solution code:
from sys import exit

s = input()
t = input()

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

for i in range(len(s)):
    if role(s,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
    tmp = S.pop(0)
    S.append(tmp)
if flag == 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

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

n=len(s)
flag=False

for i in range(n):
    last=s.pop()
    s.insert(0,last)
    #print(s)
    if s==t:
        flag=True
        break

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

Submission status: Accepted

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

N = len(S)

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

Submission status: Accepted

Solution code:
def rotate(string):
    return string[-1] + string[0:-1]


S = input()
T = input()
ans = "No"
for i in range(len(S)):
    T = rotate(T)
    if S == T:
        ans = "Yes"
        break
print(ans)

Submission status: Accepted

Solution code:
S = input()
T = input()
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())
count = 0
if s == t:
    print("Yes")
    exit()
for i in range(len(s)):
    s.append(s.pop(0))
    if s == t:
        print("Yes")
        count += 1
        break
if count == 0:
    print("No")