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

Submission status: Accepted

Solution code:
import sys

s = str(input())
p = str(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:
import sys
input = sys.stdin.readline

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

    len_s = len(s)
    len_p = len(p)

    for i in range(len_s):
        ok = True
        for j in range(len_p):
            if s[(i + j)%len_s] != p[j]:
                ok = False
                break
        if ok:
            print("Yes")
            return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

ring = ring * 2

if target in ring:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#2020-03-19
s = input() * 2
p = input()
if p in s:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
P = 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:
        is_ok =True
        break
if is_ok:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
a=list(map(str,input()))
for i in range(len(a)):
  a.append(a[i])
b=list(map(str,input()))
for i in range(len(a)):
  if a[i]==b[0]:
    if a[i:(i+len(b))]==b:
      print('Yes')
      break
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()
word = input()
ans = 0

if word in s *2:
  ans += 1
  
if ans != 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

print("Yes" if S.count(p) else "No")

Submission status: Accepted

Solution code:
if __name__ == '__main__':
  a=input()
  b=input()
  for i in range(len(a)):
    if b in a:
        print('Yes')
        break
    a=a[1:]+a[0]
  else:
    print('No')

Submission status: Accepted

Solution code:
import re
s = input()
cnt = 0
while len(s) <= 200:
    s += s[cnt]
    cnt += 1
p = input()
print('Yes' if re.search(p, s) else 'No')

Submission status: Accepted

Solution code:
s = input()*5
p = input()
if p in 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:
sen=input()
sen_2=sen+sen
word=input()
if word in sen_2:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a = input()
b = input()
sentence = list(a)
word = list(b)

def ref(a, b, flag):
    if a != b:
        flag = False
    return flag

result = 0

for i in range(len(sentence)):
    flag = True
    k = 0
    while flag == True:
        if k < len(word):
            if i+k < len(sentence):
                flag = ref(sentence[i+k], word[k], flag)
            else:
                flag = ref(sentence[i+k-len(sentence)], word[k], flag)
            k += 1
        else:
            result = 1
            break

if result == 1:
    print("Yes")
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
p = input()
ls = len(s)
lp = len(p)
res = "No"
for i in range(ls):
    if s[i] == p[0]:
        c = 1
        for j in range(1, lp):
            if s[(i + j) % ls] == p[j]:
                c += 1
        if c == lp:
            res = "Yes"
            break
print(res)

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


if p in 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
if s.find(p) != -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")

Submission status: Accepted

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

for i in range(int(len(s)/2)):
    if s[i:i+len(p)] == p:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
s, p = input(), input()
s += s
for i in range(int(len(s)/2)):
    for j in range(len(p)):
        if s[i + j] != p[j]:
            break
    else:
        print("Yes")
        break
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:
import re


def main(s, p):
    sequence = s + s
    if re.search(p, sequence):
        return 'Yes'
    else:
        return 'No'


if __name__ == "__main__":
    s = input()
    p = input()
    print(main(s, p))

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
for i in range(len(s)-len(p)):
    if s[i:i+len(p)] == p:
        print('Yes')
        exit(0)
print('No')

Submission status: Accepted

Solution code:
import sys
import itertools
import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

alphabet = [chr(ord('a') + i) for i in range(26)]
S = readline().decode('utf8').rstrip()
S += S
T = readline().decode('utf8').rstrip()
print('Yes' if T in S else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

# print(s)
for i in range(len(s)):
    pre = s[:i]
    post = s[i:]
    new_s = post + pre
    if new_s[:len(p)] == p:
        print("Yes")
        exit(0)

print("No")

Submission status: Accepted

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

s = s * 2
if s.count(p) > 0 :
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

#n= int(input())
#tmp= float(input())
s= input()
p= input()

slen=len(s)
plen=len(p)


for i in range(slen):
    for j in range(plen):
        if(s[(i+j)%slen]!=p[j]):
            break
        if(j==plen-1):
            print("Yes")
            sys.exit()
print("No")

Submission status: Accepted

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

ans = "No"
for i in range(len(s)):
    if s[i] == p[0]:
        for j in range(len(p)):
            if i + j >= len(s): break
            if s[i + j] != p[j]: break
        else:
            ans = "Yes"
print(ans)

Submission status: Accepted

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

tf = "False"

for i in range(len(s)):
    flg = "True"
    for j in range(len(p)):
        if s[(i+j)%len(s)] != p[j]:
            flg = "False"
            break
        
    if flg == "True":
        tf = "True"
        break
    
if tf == "True":
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
s = s*2
j=input()
if j 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()

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

print(ans)

Submission status: Accepted

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

for i in range(len(s)+1):
    if ss[i:i+len(p)] == p:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

Solution code:
a = input()
b = input()
print("YNeos"[not((a+a).find(b) != -1)::2])

Submission status: Accepted

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

# 前から順に検索
searching = True
s_index = 0;
p_index = 0;

loop = False

while searching:
    # print(s_index, p_index, s[s_index : s_index + 1], p[p_index : p_index + 1])
    if s[s_index : s_index + 1] == p[p_index : p_index + 1]:
        p_index += 1
        
        if p_index >= len(p):
            searching = False
            print('Yes')
            break
        
    elif loop:
        print('No')
        break
    else:
        s_index = s_index - p_index
        p_index = 0
    
    s_index += 1
    if s_index >= len(s):
        s_index = 0;
        loop = True

Submission status: Accepted

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

flg = 0
for i in range(len(txt)):
    cnt=0
    for j in range(len(target)):
        ring_idx = (i+j)%len(txt)
        #print(txt[ring_idx], cnt)
        if txt[ring_idx] != target[j]:
            break
        else:
            cnt += 1

    if cnt==len(target):
        #print(txt[ring_idx], target[j])
        #print(cnt, len(target))
        print('Yes')
        flg = 1
        break


if not flg:
    print('No')

Submission status: Accepted

Solution code:
S=input()
P=input()
SS=S+S
flag=True
flag2=False
for i in range(0,len(SS)-len(P)):
    for j in range(0,len(P)):
        if(P[j]!=SS[i+j]):
            flag=False
    if flag==True:
        print("Yes")
        flag2=True
        break;
    flag=True
if flag2==False:
    print("No")

Submission status: Accepted

Solution code:
original=input()
test=input()
len1=len(original)
len2=len(test)
original*=2
for i in range(len1+len2):
    if original[i:i+len2]==test:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

if target in inp:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
p = input()
ss = s+s
diff = False
for si in range(len(s)):
 for pi in range(len(p)):
  if ss[si+pi] != p[pi]:
   diff = True
   break
 if not diff:
  print("Yes")
  exit()
 diff = False
print("No")

Submission status: Accepted

Solution code:
#インプットdataの格納
check_data = input().lower()*2
juge_data = input().lower()

#判定結果の表示
if juge_data in check_data:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
cou=0
s,p=[],[]
s.extend(input())
p.extend(input())
s_length=len(s)
p_length=len(p)
for i in range(s_length):
    s_0=s[0]
    s=s[1:s_length]
    s.append(s_0)
    if s[0:p_length]==p:
        cou=1
        break
if cou==1:
    print("Yes") 

else :
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ringstr = input()
search = input()
ans = False
for i,ch in enumerate(ringstr):
    if ch == search[0]:
        ans = True
        for itr,j in enumerate(range(i,i+len(search))):
            if search[itr] != ringstr[j%len(ringstr)]:
                ans = False
                break

        if ans:
            break

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

Submission status: Accepted

Solution code:
import re as re
A = str(input())
ref_A = str(input())

B=A*3
if re.findall(ref_A,B)==[]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s,p=(input(),input())
for i in range(len(s)):
	if (i<len(s)-len(p) and s[i:i+len(p)] == p) or (s[i:] + s[:i - len(s)+len(p)] == p):
			print("Yes")
			exit(0)
print("No")

Submission status: Accepted

Solution code:
s = list(input())
p = list(input())
li = [i for i, x in enumerate(s) if x == p[0]]
ans = False
for l in li:
    i = l
    for check in p:
        if not s[i] == check:
            break
        i = (i+1) % len(s)
    else:
        ans = True
        break
if ans:
    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()
print("Yes" if p in (s + s) else "No")

Submission status: Accepted

Solution code:
# 文字列sを受け取る
s = input()

# 文字列pを受け取る
p = input()

# sを加工
s2 = s * 2

# 処理実行
if p in s2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
x = input()
y = input()

xResult = "No"
    
for i in range(len(x)):
    if i + len(y) <= len(x):
        if x[i:i+len(y)] == y:
            xResult = "Yes"
            break
    else:
        a = i + len(y) - len(x)
        if x[i:i+len(y)-a] + x[0:a] == y:
            xResult = "Yes"
            break

print(xResult)

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()
a = s+s[:-1]
if (p in a):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:

def find_pattern(s, p):

    l = len(s)
    res = "No"

    for i in range(l):
        if i == 0:
            new_s = s[i:l]
        else:
            new_s = s[i:l] + s[0:i]

        #print(new_s)

        if p in new_s:
            res = "Yes"

    print(res)

if __name__ == "__main__":

    s = input()
    p = input()

    find_pattern(s, p)

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=raw_input()
p=raw_input()
s=s+s
if p in s:
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
import itertools


s = input()
p = input()

n = len(p)

ans = "No"
for i in range(len(s)):
    ring = itertools.cycle(s)
    for j in range(i):
        next(ring)
    chars = [next(ring) for _ in range(n)]
    if "".join(chars) == p:
        ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
src = input() * 2

target = input()

if target in src:
    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()
p=input()
s+=s
if(p in s):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ss = s + s


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

Submission status: Accepted

Solution code:
s = input()
p = input()
q = len(s)
for i in range(len(s)):
    f = 1
    for j in range(len(p)):
        f *= (1 if s[(i+j) % q] == p[j] else 0)
        if f == 0:
            break
    if f == 1:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
import sys
s = sys.stdin.readline().rstrip()*2
l = sys.stdin.readline().rstrip()
if l in s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
p=input()
no=True
for i in range(len(s)):
    ok=True
    for j in range(len(p)):
        if s[(i+j)%len(s)]!=p[j]:
            ok=False
            break
    if ok:
        print('Yes')
        no=False
        break
if no:
    print('No')

Submission status: Accepted

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

string = string * 2
if pattern in string:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(s)):
    if p==s[i:i+len(p)]:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
p = input()
cnt = 0
for i in range(len(p)):
    if p in s:
        cnt = 1
        break
    else:
        s = s[1:]+s[0]

if cnt >= 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    #h0,w0h1,w1 = map(int, input().split())
    s=input()
    p=input()
    if len(p)>len(s):
        print("No")
        exit()
    if p in s*2:
        print("Yes")
    else:
        print("No")

main()

Submission status: Accepted

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

Submission status: Accepted

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

p = p + p
flag = False
for i in range(len(p)):
    for j in range(i, len(p)):
        if p[i:j] == s:
            flag =True

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = 0

s = input()
sw = s+s

t = input()

l = [0 for i in range(len(t))]

for i in range(len(s)):
 if s[i] == t[0]:
  for j in range(len(t)):
   l[j] = sw[i+j]
  m = "".join(map(str, l)) 
  if m == t:
    print("Yes")
    a += 1
    break
if a == 0:
  print("No")

Submission status: Accepted

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

ans = 'Yes' if p in s + s else 'No'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
word = input()
key = input()
wordcircle = word + word
bool = False

for i in range(0, len(wordcircle)-len(key)+1):
    if wordcircle[i:i+len(key)]==key:
        bool = True

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

Submission status: Accepted

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

s = s + s
s_arr = list(s)
p_arr = list(p)
i = 0
j = 0
flag = False
while i < len(s_arr) :
	if flag : break
	ii = i
	while (s_arr[ii] == p_arr[j]) :
		ii += 1
		j += 1
		if (j == len(p_arr)) :
			flag = True
			break
		if (ii >= len(s_arr)):
			break
	j = 0
	i += 1

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

Submission status: Accepted

Solution code:
s=input()
q=input()
res=0
if q in s:
    res=1
else:
    for i in range(len(s)):
        if q in s[i:len(s)]+s[:i]:
            res=1
if res==1:
    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:
txt=input()
txt+=txt[:len(txt)-1]
pat=input()
if pat in txt:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

s = s + s[:-1]

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

Submission status: Accepted

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

found=False
for i in range(0,len(s)):
    if (ss[i:i+len(p)] == p):
        found=True
        break

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

Submission status: Accepted

Solution code:
s = str(input())
p = str(input())
s = s*2
num = 0
for i in range(len(s)):
    if s[i:i+len(p)] == p:
        num += 1
if num >= 1:
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
p = input()
can_make = False
for i in range(len(s)):
    ss = ""
    if i+len(p) > len(s):
        ss = s[i:] + s[0:(i+len(p))-len(s)]
    else:
        ss = s[i:i+len(p)]
    if ss == p:
        can_make = True
        break
if can_make:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sen1=input()
sen2=input()

possible_start=[]

for i in range(len(sen1)):
    if sen2[0]==sen1[i]:
        possible_start.append(i)

if len(possible_start)==0:
    print("No")

for i in range(len(possible_start)):
    sen1_new=sen1[possible_start[i]:]+sen1[:possible_start[i]]
    if sen2 in sen1_new:
        print("Yes")
        break
    else:
        if i==len(possible_start)-1:
            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:
def is_contain(circle, target, index):
    for char in target:
        if char == circle[index]:
            index += 1
            if index == len(circle): index = 0
            continue
        else:
            return False
    return True


circle = input()
target = input()

index = 0

while True:
    try:
        index = circle.index(target[0], index)
        if is_contain(circle, target, index):
            print('Yes')
            break
        index += 1
    except ValueError:
        print('No')
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s,p=input(),input()
print("Yes" if p in s*2 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:
s = input()
p = input()

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

Submission status: Accepted

Solution code:
import re
# Inputs
s = input()
p = input()
text = s + s

# Search
if re.search(p, text):
    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() * 2
print("Yes" if input() in s else "No")

Submission status: Accepted

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

s_l = len(s)
p_l = len(p)

s_j = ((p_l // s_l) + 2) * s

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

Submission status: Accepted

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

Submission status: Accepted

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

if not tmp.find(p) == -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()
isYes = False

for start in range(0, len(s)):
    if s[start] == p[0]:
        i = start
        j = 0
        while j < len(p):
            if s[i] != p[j]:
                break
            i += 1
            if i == len(s):
                i = 0
            j += 1
        else:
            print("Yes")
            exit(0)
if not isYes:
    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:
#import pysnooper
import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

s=input().rstrip()
t=input().rstrip()
print("Yes" if t in s+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:
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 p in s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def test():

	s_original = input()
	s_string = list(s_original+s_original)
	p_string = list(input())

	for i in range(len(s_string) - len(p_string)):
		
		comp_progress = 0

		for j in range(len(p_string)):
			
			if p_string[comp_progress] == s_string[i+j]:
				comp_progress += 1
			else:
				break
			
		if comp_progress == len(p_string):
			break
	
	if comp_progress == len(p_string):
		print("Yes")
	else:
		print("No")

if __name__ == "__main__":
	test()

Submission status: Accepted

Solution code:
#coding: utf-8

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
s=input();print(['No','Yes'][input()in s*2])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
r = []
ring = list(str(input()) * 2)
ch = str(input())
for i in range(int(len(ring) / 2)):
    if ring[i : i + len(list(ch))] == list(ch):
        r.append("1")
if len(r) >= 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()


bl = False
for i in range(len(s)):
    #bl = True
    for j in range(len(p)):
        if s[(i+j)%len(s)] !=p[j]:
            break
    if(j==len(p)-1 and s[(i+j)%len(s)] ==p[j]):
        bl = True
        break
if bl:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
p = input()
len_s = len(s)
len_p = len(p)
ans = "No"
for i in range(len_s):
    match_count = 0
    for j in range(len_p):
        k = (i + j) % len_s
        if s[k] == p[j]:
            match_count += 1
        else:
            break
    if match_count == len_p:
        ans = "Yes"
        break
print(ans)

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:
# coding: utf-8
# Your code here!
s = input()
t = input()
s += s
ans = "No"
for i in range(len(s)//2):
    if s[i] == t[0]:
        for j in range(len(t)):
            if s[i+j] != t[j]:
                break
            elif j == len(t)-1:
                ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
A= input().lower()
text_input=A+A[:-1]
text_find = input().lower()

if text_input.find(text_find)!=-1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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