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:
s = input()
t = input()
ls = len(s)
s += s[0:len(t)]
f = 0
i = 0
while i < ls:
    if t == s[i:i+len(t)]:
        f = 1
        break
    i += 1
if f == 0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
def search(pat, s):
    """find a pattern 'pat' in a ring shaped text 's'
    len(s) >= len(p) and both s and p consists of lowercase characters.

    >>> search('a', 'a')
    True
    >>> search('advance', 'vanceknowledgetoad')
    True
    >>> search('advanced', 'vanceknowledgetoad')
    False
    """
    return pat in s + s


def run():
    s1 = input()
    s2 = input()

    if search(s2, s1):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    run()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#coding: utf-8

s = input()
p = input()

for i in range(len(s)):
    s = s[1:] + s[0:1]
    if s.find(p) != -1:
        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() * 2
p = input()
print("Yes" if p in s 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:
text_list = []

for x in range(2):
    if x != 1:
        text_list.append(input()*2)
    else:
        text_list.append(input())

print('Yes' if text_list[1] in text_list[0] else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    tmp = input()*2
    tmq = input()
    print('Yes' if tmq in tmp else 'No')
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
p = input()
s = s*(len(p)//len(s)+2)

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

Submission status: Accepted

Solution code:
s = input()
p = input()
s += s
ans = "No"
for i in range(len(s)//2):
      if s[i] == p[0]:
            for j in range(len(p)):
                  if s[i+j] != p[j]:
                        break
                  if j == len(p)-1:
                        ans = "Yes"
print(ans)

Submission status: Accepted

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

import sys

s = sys.stdin.readline().strip()
p = sys.stdin.readline().strip()

s += s

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

Submission status: Accepted

Solution code:
#! python3
# ring.py

sent = input()
pat = input()

len_sent = len(sent)
len_pat = len(pat)

flag = False
for i in range(len_sent):
    sent_pat = ''
    if i+len_pat <= len_sent:
        sent_pat = sent[i:i+len_pat]
    else:
        sent_pat = sent[i:len_sent] + sent[0:len_pat - (len_sent - i)]
    if sent_pat == pat:
        flag = True

if flag:
    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:
s = input() * 2
p = input()
if p in s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
 
S = raw_input()
S = S*2
 
T = raw_input()
 
if T in S:
    print "Yes"
else:
    print "No"

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sentence = input().lower()
ans = input().lower()
doublesentence = sentence + sentence 
print("Yes" if  ans in doublesentence else "No")

Submission status: Accepted

Solution code:
s=input()
p=input()
s_len=len(s)
p_len=len(p)
s_list=list(s)
p_list=list(p)
i=0;j=0;ans='No'
while i<=s_len:
    for j in range(p_len):
        if s_list[(i+j)%s_len]!=p_list[j]:
            break
    else:
        ans='Yes'
        break
    i+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def cilcle(s, n):
    result = ""
    for i in range(n):
        result += sen[i%len(sen)]
    return result

if target in cilcle(sen, len(sen)**2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input() * 2
p = input()
print("Yes" if s.find(p, 0, len(s) )>= 0 else "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:
# AOJ ITP1_8_D

def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    string = input()
    string += string
    p = input()
    # 文字列を2倍してその中から探す。
    # 1≦pの長さ≦sの長さなのでこれでいい。
    # 文字列含有には「文字列」.find(「探したい文字列」)を使う。
    if string.find(p) >= 0: print("Yes")
    else: print("No")

if __name__ == "__main__":
    main()

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:
a=input()
b=input()
a=a+a[:-1]
if a.find(b)!=-1:
        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 = str(input())
p = str(input())

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

Submission status: Accepted

Solution code:
s = input()
p = input()
s_len = len(s)
p_len = len(p)
for i in range(s_len):
    for j in range(p_len):
        same = True
        if s[(i+j)%s_len] != p[j]:
            same = False
            break
    if same:
        print("Yes")
        exit(0)
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
p = list(input())
s += s
for x in range(len(s*2)):
    if p == s[x:x+len(p)]:
        print("Yes")
        break
    else:
        pass
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
p = input()
ret = 'No'
tts = s + s[:len(p)]
if p in tts: ret = 'Yes'
print(ret)

Submission status: Accepted

Solution code:
# Ring

ring = input()
word = input()

doubleRing = ring * 2
ringCut = doubleRing.split(word)
# print(ringCut)

if ringCut[0] == doubleRing:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
from functools import reduce;s, p = input().strip(), input().strip();
print( "Yes" if reduce(lambda a,b: a or b , [ (s[i:]+s[:i]).find(p) > -1 for i in range(0, len(s)) ] ) else "No" )

Submission status: Accepted

Solution code:
cir = (str(input()))
cir_l = list(cir)
a = list(cir)
word = str(input())
word_l = list(word)
c = 0
for i in range(len(a)):
    cir_l.append(a[i])
for i in range(len(a)):
    w = ''
    for k in range(len(word_l)):
        w = w + cir_l[i+k]
    if (w == word):
        c = 1
if (c):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
p = input()
s = s + s
print("Yes" if p 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*=2
if s.find(p)!=-1:
    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 = 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()
print('Yes' if p in s+s else 'No')

Submission status: Accepted

Solution code:
s=input()
s+=s
p=input()
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()

s=s+s[:-1]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
p = input()
ss = s + s
if ss.find(p) < 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
p = input()
S = s + s
if S.find(p) < 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
n=input()
N=n*2
#print(N)
a=input()
#print(a)
if a in N:
    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 += s
a = s.count(p)

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
s=input()
p=input()

S=s*2

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:
import re
s=input()
p=input()
s_s=s+s
match=re.search(p,s_s)
if match:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()*2
t=input()
if t 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 = list(input())
p = list(input())
for x in range(len(p)) :
    s.append(s[x])

i = 0
j = 0
while True :
    if p[j] == s[i] :
        j += 1
        if j == len(p) :
            print("Yes")
            break
        i += 1
        if i == len(s) :
            print("No")
            break
    else :
        i += (1 - j)
        if i == len(s) :
            print("No")
            break
        j = 0

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 = str(input())
p = str(input())
if p[0] not in s:
	print("No")
elif p in s:
	print("Yes")
else:
	for i in range(len(s)):
		s = s[1:] + s[:1]
		if p in s:
			print("Yes")
			break
	else:
		print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = list(input())
y = list(input())
for a in range(len(y)):
    x.append(x[a])

i = 0
j = 0
while True :
    if y[j] == x[i]:
        j += 1
        if j == len(y):
            print("Yes")
            break
        i += 1
        if i == len(x):
            print("No")
            break
    else :
        i += (1 - j)
        if i == len(x):
            print("No")
            break
        j = 0

Submission status: Accepted

Solution code:
s=str(input())
p=str(input())
s=s+s
if p in s:
    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 = input()
p = input()
s += s
#print(s)

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+s
print('Yes' if s.count(p) else 'No')

Submission status: Accepted

Solution code:
n=str(input())
a=len(n)
N=list(n)
m=str(input())
A=len(m)
x=0
for i in range(a):
    C=[]
    for i in range(A):
        C.append(N[i])
    B=''.join(C)
    c=N[0]
    if B==m:
        x=x+1
    N.remove(c)
    N.append(c)
if x>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:
s=input()
p=input()
b=s
s+=s
ans=0
same_count=0
for i in range(len(b)):
    for j in range(len(p)):
        if s[i+j]==p[j]:
            same_count+=1

    if same_count==len(p):
        ans=1
    same_count=0

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
s = input()
p = input()
ss = s + s
if (  p in ss ) ==True:
    print("Yes")
else:
    print('No')

Submission status: Accepted

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

for i in range(len(str)):
    strtemp = str[i:len(str)] + str[0:i]
    if p in strtemp:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
#58リング
W=str(input())
n=str(input())
w=W*2
if n in w:
    print("Yes")
else:
    print("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() * 2
p = input()
print('Yes' if p in s else'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()
s = s + s

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

Submission status: Accepted

Solution code:
#
# 8d
#


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

circle = text+text[:-1]

if circle.find(w) != -1:
    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*=2
if s.find(p)!=-1:
    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()
p = input()
s += s[:len(p)]
if p in s:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
ring = input()
tag = input()

if tag in ring*2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
p=input()
s2=s*2
ren=s2.count(p)
if ren==0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
p = list(input())
for x in range(len(p)) :
    s.append(s[x])

i = 0
j = 0
while True :
    if p[j] == s[i] :
        j += 1
        if j == len(p) :
            print("Yes")
            break
        i += 1
        if i == len(s) :
            print("No")
            break
    else :
        i += (1 - j)
        if i == len(s) :
            print("No")
            break
        j = 0

Submission status: Accepted

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

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()*2
p=input()
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:
N=input()
N=N+N
S=input()
if S in N:
    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()

ss = s*2
# lis = list(s*2)
# lip = list(p)
# nump = len(lip)

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

else :
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
s = input()
p = input()

s+=s

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

Submission status: Accepted

Solution code:
s=input()
p=input()
match=False
for i in range(len(s)):
  if s[i]==p[0]:
    if len(p)>1:
      for j in range(1,len(p)):
        if s[(i+j)%len(s)]!=p[j]:
          break
        if j==len(p)-1:
          match=True
    else:
      match=True

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

Submission status: Accepted

Solution code:
import sys

s = list(input())
p = list(input())
for i in range(len(s)):
  counter = 0
  for j in range(len(p)):
    m = (i+j)%len(s)
    if s[m] == p[j]:
      counter += 1
  if counter == len(p):
    print('Yes')
    sys.exit()
print('No')

Submission status: Accepted

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

s=input()*2
p=input()

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

Submission status: Accepted

Solution code:
s=input()
p=input()
s=s+s
a=s.find(p)
if a==-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_long = s + s

judge = p in s_long
if judge:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
ring_str=input()
key=input()

ring_str+=ring_str

if key in ring_str:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=str(input())
p=str(input())
ss = s*2
hantei = p in ss

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

Submission status: Accepted

Solution code:
a=input()
b=input()
c=a*2

if b in c:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n=input()
s = n + n
l=input()
b = s.count(l)
if b == 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
import sys
s = input()
ls = len(s)
s += s
p = input()
lp = len(p)
for i in range(ls):
    if s[i:i + lp] == p:
        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[i:] + S[:i]:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

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:
a = input()
b = input()
m = a*2
taiga = m.count(b)

if taiga >= 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s = s * 2

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

print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s += s
p = input()
k = s.count(p)
if k>= 1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()*2
p=input()
if s.count(p)>0 :
    print('Yes')
else: print('No')

Submission status: Accepted

Solution code:
s_str = input()
p_str = input()
s_str = s_str * 2

if p_str in s_str:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

x=p in s1
if x==True:
    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()
p=input()
if p in s+s:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
p = str(input())
s=s*2
if p in s:
    print("Yes")
else:
    print("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=str(input())
p=str(input())
s+=s
if s.find(p)<0:
    print("No")
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()
s = s + s[:-1]
p = input()
# print(s)



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

Submission status: Accepted

Solution code:
s=input()
p=input()
s=s+s
l=0
s=s.lower()
if  s.find(p)==-1:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S=str(input())
P=str(input())

A=S.count(P)

if A==0:
    B=S+S
    C=B.count(P)
    if C==0:
        Q=0
    else:
        Q=C
else:
    Q=A
    


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

Submission status: Accepted

Solution code:
# B_D
circle = input() * 2
target = input()
if target in circle:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

p = input()

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

Submission status: Accepted

Solution code:
a=[s for s in input()]*2
b=input()
w=False
for j in range(len(a)):
    if a[j]==b[0]:
        total=1
        if len(b)==1:
            print("Yes")
            w=True
            break
        for i in range(1,len(b)):
            if j+i==len(a):
                print("No")
                w=True
                break
            else:
                if a[j+i]==b[i]:
                    total+=1
                    if total==len(b):
                        print("Yes")
                        w=True
                        break
                else:
                    break
    if w==True:
        break
if w==False:
    print("No")

Submission status: Accepted

Solution code:
input_string = input()
pattern = input()

ring_string = input_string + input_string

if pattern in ring_string:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
text = list(input())
pattern = list(input())
for i in range(len(text)):
    
    flg = True
    for j in range(len(pattern)):
        if text[(i + j) % len(text)] != pattern[j]:
            flg = False
            break
    
    if flg:
        break

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

Submission status: Accepted

Solution code:
s1=input()
s2=input()

for i,x in enumerate(s1):
    if s2[0]==x:
        work=s1[i:]+s1
        if s2 in work :
            print("Yes")
            exit()
print("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,P = open(0).read().split()
if P in S+S:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
l=[]
s=input()
p=input()
d=len(p)
r=len(s)-len(p)
for i in range(r+1):
    u=s[i:i+len(p)]
    l.append(u)
y=0
for i in range(d):
    w=s[-len(p)+i:len(s)]+s[0:i]
    l.append(w)
d=l.count(p)
if d==0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input().replace("\r", "").replace("\n", "")
s *= 2
p = input().replace("\r", "").replace("\n", "")
print("Yes" if p in s else "No")

Submission status: Accepted

Solution code:
import sys

s = input()
p = input()

s_len = len(s)
p_len = len(p)
cur_s_pos = 0
cur_p_pos = 0

for i in range(s_len):
    if s[i] == p[0]:
        cur_s_pos = i
        cur_p_pos = 0
        #print("比較：%s %s" % (s[cur_s_pos], p[cur_p_pos]))
        try:
            for j in range(100):
                if s[cur_s_pos] == p[cur_p_pos]:
                    cur_s_pos += 1
                    cur_p_pos += 1
                else:
                    break

                if cur_p_pos == p_len:
                    break

                if cur_s_pos >= s_len:
                    cur_s_pos = 0
        except IndexError:
            print("s_pos, p_pos : %d, %d" % (cur_s_pos, cur_p_pos))
            sys.exit()

        if cur_p_pos == p_len:
            break

        

if cur_p_pos == p_len:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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


resolve()

Submission status: Accepted

Solution code:
s = input()
len_s = len(s)
p = input()
len_p = len(p)

ans = "No"

for i in range(0, len_s - len_p + 1):
    if s[i:i+len_p] == p:
        ans = 'Yes'
        break
else:
    for j in range(len_p):
        if s[-j:] + s[:len_p - j] == p:
            ans = 'Yes'
            break
print(ans)

Submission status: Accepted

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

s_double = s * 2

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

Submission status: Accepted

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

Submission status: Accepted

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

pf=p[0]
l=len(pf)
flag=0
if pf in s:
  for i in range(len(s)):
    if s[i]==pf:
      word=''
      for j in range(i,i+len(p)):
        j=j%(len(s))
        word+=s[j]
      if word==p:
        flag=1
        break
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
p = str(input())
m = s + s[0:-1]
if 0 <= m.find(p):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=str(input())
p=str(input())
S=list(s)
x=0
for i in range(len(s)):
    if p in s:
        print('Yes')
        x=1
        break
    S.append(S[0])
    S.pop(0)
    s=''.join(S)
if x==0:
    print('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 = str(input())
p = str(input())
s = s + s
if s.find(p) < 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
p = input()
S = s + s
if S.find(p)==-1:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
#58 リング

s = input().upper()*2
p = input().upper()

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

Submission status: Accepted

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

s = input()
p = input()
s += s

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

Submission status: Accepted

Solution code:
w=input().casefold()
word=w*2


key=input()

if key in word :
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    string = input()
    p=input()
    string+=string

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

if __name__=="__main__":
    main()

Submission status: Accepted

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

size_s = len(s)
size_p = len(p)

_s = s+s

for i in range(size_s):
    if _s[i: i + size_p] == p:
        print("Yes")
        quit()

print("No")

Submission status: Accepted

Solution code:

s = input()
p = input()

ss = s + s

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

Submission status: Accepted

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

k=s*100

if (p in k)==True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

c=s.count(p)
if c>=1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

def search_string_in_cycle_string(s, p):
    code = s + s
    for index in range(len(s)):
        tmp = code[index:index+len(p)]
        if p == tmp:
            return True
    return False

if search_string_in_cycle_string(s, p):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = input() * 2
w = input()

print("Yes" if w in x else "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:
x=0
s=input()
p=input()

S=s+s

x+=S.find(p)
#print(S)
#print(p)
#print(x)

if x==-1:
    print('No')
else :
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

d = deque([s for s in p])

for i in range(len(s)):
    str_d = "".join(d)
    if s in str_d:
        print("Yes")
        break
    d.append(d.popleft())
    if i == len(s) - 1:
        print("No")

Submission status: Accepted

Solution code:
a = input()
b = input()
m = a*2
taiga = m.count(b)
#print(taiga)
if taiga >= 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s = s + s

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