Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Ring

  Write a program which finds a pattern $p$ in a ring shaped text $s$.

Input

  In the first line, the text $s$ is given.

  In the second line, the pattern $p$ is given.

Output

  If $p$ is in $s$, print Yes in a line, otherwise No.

Constraints

$1 \leq $ length of $p \leq $ length of $s \leq 100$

$s$ and $p$ consists of lower-case letters

Sample Input 1

vanceknowledgetoad
advance

Sample Output 1

Yes

Sample Input 2

vanceknowledgetoad
advanced

Sample Output 2

No



Sample input:
vanceknowledgetoad
advance


Sample output:
Yes

Submission status: Accepted

Solution code:
string=input()
serch=input()
new_string=string*2
answer=0
for s in range(len(new_string)):
    if new_string[s]==serch[0]:
        if new_string[s:s+len(serch)]==serch:
            answer+=1
if answer>0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


S = str(input())
P = str(input())

is_ok = False

for i in range(len(S)):
    FLG = True
    for k in range(len(P)):
        if S[(i+k)%(len(S))] != P[k]:
            FLG = False
            break

    if FLG == True:
        is_ok = True
        break

if is_ok == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
p = input()
 
s += s
 
if s.count(p):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
s=s+s
p=input()
if s.count(p)>0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

print('Yes' if p in s*2 else 'No')

Submission status: Accepted

Solution code:
string = input()
 
string *= 3 # 同じ内容を3回繰り返す
 
if string.find(input()) != -1: 
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:

try:
    while True:
        str=input()
        word=input()
        str+=str
        str+=str
except EOFError:
    pass
if word in str:
    print('Yes',end='')
else:
    print('No',end='')
print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    input_str = input()
    pattern = input()
    input_str = input_str + input_str
    if pattern in input_str:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
import sys

s = list(input())  # 文字列を1文字ずつのリストにする(1文字ずつアクセスしたいので)
p = input()
for i in range(len(s)):
    j = i
    c = 0
    x = ""
    while c < len(p):
        if j == len(s):
            j = 0
        x += s[j]
        j += 1
        c += 1
    if p == x:
        print("Yes")
        sys.exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding=utf-8

###
### for atcorder program
###

import sys

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def get_input():
    N = []
    while True:
        try:
            N.append(input())
        except EOFError:
            break
    return N

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

    S = S + S[:len(P)]

    if S.find(P) == -1:
        print('No')
    else:
        print('Yes')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
s += s
p = input()

print("Yes" if p in s else "No")

Submission status: Accepted

Solution code:
I1 = str(input())
I2 = str(input())

I = (I1)*2
if I2 in I:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
I = input()
s = I*2

P = input()

if P in s :
  print('Yes')
else :
  print('No')

Submission status: Accepted

Solution code:
str1 = input()
s = list(str1)
str2 = input()
p = list(str2)

for i in range(len(s)):
    count = 0
    for j in range(len(p)):
        #print(i,j)
        if s[(i+j)%len(s)] != p[j]:
            break
        else:
            count = count + 1
    if count == len(p):
        print('Yes')
        #print(count)
        break

if count != len(p):
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
array_s=[]
result=[]
flg=0
###入力############
text_s=input()

text_p=input()
###################

array_s=list(text_s)


##組み合わせを考える

end=len(array_s)
new=""
#配列は0から;endまで

for k in range(0,end):

    for i in range(k,end):
        new=new+array_s[i]
    for j in range(0,k):
        new=new+array_s[j]
    result.append(new)
    new=''

for i in result:
    if text_p in i:
        flg=1
    else:
        pass

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

Submission status: Accepted

Solution code:
s = input()
p = input()
"""
num = len(p)
print(num)

a = 0
for i in s:
  for j in p:
    if i == j:
      a+=1
"""
#print(s*2)
      
if p in s*2:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
    
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
    
    
S = str(input())
P = str(input())
    
is_ok = False
    
for i in range(len(S)):
    FLG = True
    for k in range(len(P)):
        if S[(i+k)%(len(S))] != P[k]:
            FLG = False
            break
    
    if FLG == True:
        is_ok = True
        break
    
if is_ok == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s +=s

if s.count(p):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
   
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
   
   
S = str(input())
P = str(input())
   
is_ok = False
   
for i in range(len(S)):
    FLG = True
    for k in range(len(P)):
        if S[(i+k)%(len(S))] != P[k]:
            FLG = False
            break
   
    if FLG == True:
        is_ok = True
        break
   
if is_ok == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ss= s+s



if ss.find(p)>=0:
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
flag = 0
str1 = input()
str2 = input()
str1 *= 2
for i in range(len(str1)):
    if str1[i:i+len(str2)] == str2:
        flag=1
        break
if flag==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:

s = input()
p = input()

s=s+s[:-1] #始点から最後から一つ前の文字まで取得して連結
if s.find(p)!=-1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ls=len(s)
lp=len(p)

for i in range(ls):
    if i+lp<=ls:
        #s[:]が正しい。s[,]になってた。
        j=i+lp
        check=s[i:j]
    else:
        check1=s[i:ls]#s[a:b]はbの文字を含まない
        check2=s[0:i+lp-ls]
        check=check1+check2
        #print(check1+"1"+p)
        #print(check2+"2"+p)
        #print(check+"3")
    if check==p:
        print("Yes")
        break
    elif i==ls-1:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()*2
p = input()

if p in s:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

if p in s * 2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s *= 2
if p in s:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#ITP1_8_D
s = input()
p = input()

if p in s*2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def eval_ring_text(text, target):
    return target in (text * 2)



if __name__ == "__main__":
    text = input()
    target = input()



    if eval_ring_text(text, target):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
text = input()
sx   = input()

text = text + text
text.lstrip()
text.rstrip()
index = text.find(sx)
if index != -1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def get_substr(i, l, s):
    j = (i + l) % len(s)
    if j > i:
        return s[i:j]
    else:
        return s[i:] + s[:j]


s = input()
p = input()

for i in range(len(s)):
    if get_substr(i, len(p), s) == p:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

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

str = s * 2
if p in str:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

if p in s + s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	data = str(input()) * 2
	pattern = str(input())
	try:
		data.index(pattern)
		print("Yes")
	except:
		print("No")

Submission status: Accepted

Solution code:
ring = input()
s = ring * 2
p = input()
if s.find(p) == -1:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
x = input()
y = input()
x *= 2
if y in x:
     print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    s = input()
    p = input()
    ss = s * 2
    flag = False
    for i in range(len(ss) - len(p)):
        if ss[i:i+len(p)] == p:
            flag = True
            break
    print("Yes" if flag else "No")

Submission status: Accepted

Solution code:
x = input()
y = input()
z = x * 100

if z.find(y) >= 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
text = input()
judge_string = input()
for i in range(len(text)):
    if judge_string in text:
        print('Yes')
        break
    else :
        text = list(text)
        pop_text = text.pop()
        text.insert(0, pop_text)
        text = ''.join(text)
        if i == len(text) - 1:
            print('No')

Submission status: Accepted

Solution code:
s = input()
p = input()
s = s*2

if p in s:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# ITP1_8_D
# リング

s = input()
p = input()

if p in s * 2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s2 = s * 2
if p in s2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = str(input())
p = str(input())
 
ans = False
 
for i in range(len(s)):
    a = True
    for k in range(len(p)):
        if s[(i+k)%(len(s))] != p[k]:
            a = False
            break
 
    if a == True:
        ans = True
        break
 
if ans == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a = input()
b = input()
a += a[:-1]
if b in a:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

check = False

for i in range(len(s)):
  is_ans = True
  for k in range(len(p)):
    if s[(i+k)%(len(s))] != p[k]:
      is_ans = False
      break

  if is_ans:
    check = True
    break

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

Submission status: Accepted

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

str = ""
for i in range(max(100//len(s)+1,2)):
        str += s

if str.find(p) == -1:
        print("No")
else:
        print("Yes")

Submission status: Accepted

Solution code:
inp = input()
inp2 = inp*2

chk = input()

if chk in inp2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
p = input()
ling = s + s
ans = True
for i in range(len(s)):
    ans = True
    for j in range(len(p)):
        ans = ling[i + j] == p[j] and ans
    if ans:
        print("Yes")
        break

if not ans:
    print("No")

Submission status: Accepted

Solution code:
s = input()
p = input()
judge = True
x = s+s
if x.find(p) != -1:
    judge = True 
else:
    judge = False

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

Submission status: Accepted

Solution code:
import sys

S = str(input())
P = str(input())

for i in range(len(S)):
    FLG = True

    for k in range(len(P)):

        if S[(i+k)%(len(S))] != P[k]:
             FLG = False
             break
    if FLG == True:
        break

if FLG == True:
    print("Yes")

else :
    print("No")

Submission status: Accepted

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

ss = s*(len(s)//len(p)+1)

if p in ss:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
str = input()
str2 = input()
str=str+str

if str.find(str2) != -1:
  print('Yes')
else :
  print('No')

#print(str)
#print(str2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [x for x in input()]
l.extend(l)
ch = [ x for x in input()]
txt = "No"
for i in range(len(l)-len(ch)):
    for j in range(len(ch)):
        if l[i+j] != ch[j]:
            break
    else:
        txt ="Yes"
        break
print(txt)

Submission status: Accepted

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

if p in (s+s):
    print ("Yes")
else:
    print ("No")

Submission status: Accepted

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

ss = s*2

if p in ss:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(s)):
  string = ""
  if (len(s)-((i+1)+len(p)) < 0):
    string = s[i:] + s[:(i+1)+len(p)]
  else:
    string = s[i:]
  if string.startswith(p):
    print("Yes")
    break
  if i == len(s)-1:
    print("No")

Submission status: Accepted

Solution code:
s=input()*2
p=input()
print('YNeos'[p not in s::2])

Submission status: Accepted

Solution code:
# coding: utf-8
s = input().rstrip()
p = input().rstrip()
s2 = s*2
print("Yes" if (p in s2) else "No")

Submission status: Accepted

Solution code:
from re import search


a = input()
b = input()
rg = '.*'.join(b)


def search_string():
    for i in range(len(a)):
        if search(b, a[i:]+a[:i]):
            return 'Yes'
    return 'No'


print(search_string())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
p=input()
spattern=[]
spattern.append(s)
pat=len(s)
plen=len(p)
flg=0
for i in range(1,pat):
    temp = spattern[i-1][1:] + spattern[i-1][0]
    spattern.append(temp)
for i, line in enumerate(spattern):
    for j in range(pat-plen+1):
        if line[j:j+plen] == p:
            flg = 1
            break
    if flg == 1:
        break
if flg == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
str = input()
str *= 2
compare = input()

if compare in str:
        print('Yes')
else:
        print('No')

Submission status: Accepted

Solution code:
s = str(input())
sdouble = s*2

p = str(input())

if sdouble.find(p)!= -1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

n = len(p)
for x in range(n):
    flag = True
    for y in range(len(s)):
        if p[(x + y) % n] != s[y]:
            flag = False
            break
    if(flag):
        break

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

Submission status: Accepted

Solution code:
s = input()
p = input()
_s = s + s[:-1]
if p in _s:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input() * 3
p = input()

print("Yes" if p in s else "No")

Submission status: Accepted

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

Submission status: Accepted

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

a = s*2
if p in a:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
r = input()
t = input()
rr = r+r
f = rr.find(t)
if f != -1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
p = input()
sList = list(s)
[sList.append(i) for i in s]
sStr = ''.join(sList)
judge = sStr.find(p)
if judge == -1:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s, p = (line.strip() for line in sys.stdin.readlines())
print('Yes' if p in s + s else 'No')

Submission status: Accepted

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

s = s + s

if s.find(p) != -1:
	print('Yes')
else:
	print('No')

Submission status: Accepted

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

Submission status: Accepted

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

s = s*2

if p in s:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

S = s * 2

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

print("Yes")

Submission status: Accepted

Solution code:
text = input()
ptn = input()
print(['No', 'Yes'][(text*2).find(ptn) != -1])

Submission status: Accepted

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

s_l=[]
p_l=[]

for i in s:
    s_l.append(i)

for i in p:
    p_l.append(i)

for i in range(len(s_l)):
    j=0
    while j<len(p_l):
        k=i+j
        if k>=len(s_l):
            k=k-len(s_l)

        if s_l[k]==p_l[j]:
            j=j+1
        else:
            break
    if j==len(p_l):
        print("Yes")
        break
            
if j<len(p_l):
    print("No")

Submission status: Accepted

Solution code:
S=input();print(['No','Yes'][input()in S*2])

Submission status: Accepted

Solution code:
str1 =  str(input()) * 2
str2 =  str(input())
if (str1.find(str2) != -1 ):
    print("Yes")
else:
    print ("No")

Submission status: Accepted

Solution code:
string = input()
string1 = string+string 
try:
    string1.index(input())  
    print("Yes")
except ValueError:
    print("No")

Submission status: Accepted

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

print( "Yes" if p in s*2 else "No" )

Submission status: Accepted

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

s += s

if s.count(p):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()*2
p = input()

if p in s:
   print('Yes')
else:
   print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input() * 2
p = input()

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

Submission status: Accepted

Solution code:
str = input()
sstr = str + str
pstr = input()
if (pstr in sstr):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def find(A,i,B,j):#Bのｊ番目以降の文字列がAのi番目以降の文字列と一致する場合は１を返す
    if(A[i]!=B[j]):
        return 0
    elif(j==len(B)-1):
        return 1
    else:
        return find(A,(i+1)%len(A),B,j+1)



str=list(input())
key=list(input())
for i in range(0,len(str)):
    if(find(str,i,key,0)):
        print("Yes")
        sys.exit()
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A=input()
a=A*2
b=input()
ans=a.find(b)
if ans==-1:
	print('No')
else:
	print('Yes')

Submission status: Accepted

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

# ITP1_8_D

N=input()
N=N*2
S=input()

if S in N:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ss = s + s

if ss.count(p) > 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
str_in = []
while True:
    try :
        str_in.append(input()) 
    except :
        break
s = str_in[0]
p = str_in[1]

flag = False
for i in range(0, len(s)):
    flag = True
    for j in range(0, len(p)):
        if (s[(i + j) % len(s)] != p[j]):
            flag = False
            break
    if (flag):
        break
if (flag):
    print('Yes')
else :
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
strS = str(input())
strP = str(input())
longS = ''

for i in range(2):
    longS += strS

if strP in longS:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

ring = s * 2

if ring.find(p) == -1:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

s = s + s

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

Submission status: Accepted

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

Submission status: Accepted

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

if p in 2 * s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = str(input())
p = str(input())
S = s*3
k = 0

for i in range(len(S)):
    
    if S[i:len(p)+i:] == p:
        k = k+1

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

Submission status: Accepted

Solution code:
s = input()
#str = s + s
str = 2 * s
s = input()

print("Yes" if s in str else "No")

Submission status: Accepted

Solution code:
S=input()
S=S+S
P=input()
if P in S:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ring = s + s

if ring.find(p) != -1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def ring(s, p):
	t = list(s)
	for i in range(len(s)):
		if ''.join(s[i:] + s[:i]).find(p) > -1:
			return 'Yes'
	return 'No'

s = input()
p = input()
print(ring(s, p))

Submission status: Accepted

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

def figure(s, p):
    if p in s:
        return True

    i = 0
    while True:
        idx = p[i:].find(s[-1]+s[0])
        if idx == -1:
            break
        idx += i
        if s[-(idx+1):]+s[:len(p)-(idx+1)] == p:
            return True
        i = idx+1
    return False

if __name__ == '__main__':
    s, p = raw_input(), raw_input()
    print 'Yes' if figure(s, p) else 'No'

Submission status: Accepted

Solution code:
word = input()*2
p = input()
if p in word:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
sss = input()
sss += sss
p = input()
if sss.count(p) > 0: print('Yes')
else: print('No')

Submission status: Accepted

Solution code:
data1 = input()
data2 = data1 +data1
if input() in data2:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
print("Yes" if input()*2.find(input()) else "No")

Submission status: Runtime Error

Solution code:
s=input()
p=input()
sl = [i for i in s]
pl = [i for i in p]
lenp=len(p)
pp=pl[-1]
pcheck=-1
el=[i for i,x in enumerate(sl) if x==pp]
check=0
for i in el:
    while True:
        if sl[i]==pl[pcheck]:
            i-=1
            pcheck-=1
        else:
            break
        if pcheck+lenp==0:
            check+=1
            break
if check==0:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
s=input()
p=input()
sl = [i for i in s]
pl = [i for i in p]
lenp=len(p)
pp=pl[-1]
pcheck=-1
el=[i for i,x in enumerate(sl) if x==pp]
check=0
for i in el:
    while True:
        if sl[i]==pl[pcheck]:
            i-=1
            pcheck-=1
        else:
            break
        if pcheck+lenp==0:
            check+=1
            break
    if check==1:
        break
if check==0:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
def saiki(stri, i, nagasa):
    if stri[0, i] == stri[1,i]:
        if(nagasa == 1):
            return 1
        else:
            nagasa -=1
            stri.pop(0)
            i +=1
            saiki(stri, i, nagasa)
    else:
        return 0

import sys
input_str = sys.stdin.readlines()
inputs = list(input_str)

for i in range(len(stri[0])):
    if saiki(inputs[0, i], i, len(inputs[1])) ==1:
        print("Yes")
    else:
        if i == len(stri[0]) -1:
            print("No")
        pass

Submission status: Runtime Error

Solution code:
data = input()
target = input()

start = 0
flag = "No"
for i in target:
    if(data[start:].find(i)):
        start = data[start:].find(i)
    elif(data[:start].find(i)):
        start = data.[:start:].find(i)
    else:
        print("No")
        break
    if(i == target[-1]):
        print("Yes")
        break

Submission status: Runtime Error

Solution code:
data = input()
target = input()

start = 0
flag = "No"
for i in target:
    if(data[start:].find(i)):
        start = data[start:].find(i)
    elif(data[:start].find(i)):
        start = data.[:start].find(i)
    else:
        print("No")
        break
    if(i == target[-1]):
        print("Yes")
        break

Submission status: Runtime Error

Solution code:
def find_word(sent, word):
    w = word    
    if sent.find(w) > -1:
        return w,y
    elif len(w) == 0:
        return w,"No"
    else:
        return find_word(sent,w[:-1])


sent = raw_input()
word = raw_input()
s = ""
s,y = find_word(sent,word)

b = word.replace(s,"")

a,y= find_word(sent,b)
print y

Submission status: Runtime Error

Solution code:
def find_word(sent, word,s):
    w = word    
    if len(w) > 0 :
        if sent.find(w) >= 0:
            return s
        else:
            s+=1
            return find_word(sent,w[:-1],s)
    else :
        return -1

sent = raw_input()
word = raw_input()

s = find_word(sent,word,s)
if s == -1:
    print "No"
else:
    s = word[len(word)-s:len(word)]

    if sent.find(s) >=0:
        print "Yes"
    else:
        print "No"

Submission status: Runtime Error

Solution code:
s = input()
p = input()
s = s + s[0:len(p)]
if s.find(p):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import re
import numpy

Submission status: Runtime Error

Solution code:
half_ring=raw_input()
ring=s*2
target=raw_input()
f=0

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

Submission status: Runtime Error

Solution code:
s = [input().string()]
print('endswith[a, start][e, end]')

Submission status: Runtime Error

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

s *= 2

if s.finr(p) != -1:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s = print()
p = print()

s *= 2
if s.find(p) ! = =1:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s = print()
p = print()

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

Submission status: Runtime Error

Solution code:
s = print()
p = print()

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

Submission status: Runtime Error

Solution code:
s = input()
p = input()
????
s += s[:len(p)]
if p in s:
????????print("Yes")
else:
????????print("No")

Submission status: Runtime Error

Solution code:
s=input()
p=input()
print("Yes" if p in s+s)

Submission status: Runtime Error

Solution code:
def check(s, p):
    count = 0
    for i in range(len(s)):
        for j in range(len(p)):
            if s[(i+j) % len(s)] != p[j]:
                break
            count += 1
        if count == len(p):
            return True
    return False

s, p = raw_input()
flag = check(s, p)
if flag:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
x = input()
y = input()
##advencedknowledge
a = [["advanceknowledge"]for i in range(10)]
b = ""
for i in a:
    b = b + "".join(i)


if b.count(y) > 0:
    print("Yes")
else: print("No")