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()
p = input()
S = s*2
a = S.count(p)
if a >=1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
p = input()
s = s + s
ans = s.find(p)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
p = input()
s *= 2
ans = 'No'
for i in range(len(s)):
    if s[i:i+len(p)] == p:
        ans = 'Yes'
        break
print(ans)

Submission status: Accepted

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

ss = s+s

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

Submission status: Accepted

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

Submission status: Accepted

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

if (p in s) == 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:
# coding: utf-8

s = input()
p = input()

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

Submission status: Accepted

Solution code:
S = str(input())
S2 = S * 2
s = str(input())
checker = s in S2

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

Submission status: Accepted

Solution code:
a = [list(input()) for i in range(2)]
for i in range(len(a[0])):
  for j in range(len(a[1])):
    if i+j< len(a[0]):
        if a[0][i+j] != a[1][j]:
          break
    else:
        if a[0][i+j-len(a[0])] != a[1][j]:
          break
    if j == len(a[1]) - 1:
      print('Yes')
      exit()
print('No')

Submission status: Accepted

Solution code:
from collections import deque

s = input()
t = input()
n = len(s)
d = deque(s)
for i in range(n):
    p = d.pop()
    d.appendleft(p)
    u = ''.join(d)
    if t in u:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

ch1 = input()*2
ch2 = input()

if re.search(ch2, ch1):
    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()
s+=s

p = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s, p = [input() for _ in range(2)]

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

Submission status: Accepted

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


def search(s, p):
    index = [i for i, x in enumerate(s) if x == p[0]]
    while len(s) <= 100:
        s += s
    for index in index:
        for i in range(0, len(p)):
            if s[index + i] != p[i]:
                break
            if i == len(p) - 1:
                return 'Yes'
    return 'No'


print(search(s, p))

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:
a=input()
b=input()
a*=2
if a.find(b)!=-1:
    print("Yes")
else :
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

sl=len(s)
k=0

for i in range(sl):
    if p in s:
        k=1
        break
    else:
        s=s[-1]+s[:-1]


if k==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 = str(input())
s2 = s*2
p = str(input())

if s2.count(p) > 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x=input()
y=input()
X=x*2
if X.find(y)==-1:
    print("No")
else:
    print("Yes")

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 = list(input())
p = list(input())

def search_from(i):
    found = True
    for j in range(len(p)):
        k = (i + j) % len(s)
        if s[k] != p[j]:
            found = False
            break
    return found

found = False
for i in range(len(s)):
    found = search_from(i)
    if found:
        break
    
if found:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#s = 'vanceknowledgetoad'
#p = 'advance'
s = stdin.readline().rstrip()
p = stdin.readline().rstrip()

s = s * 2
#print(s)
#print(len(p))
cnt_match_inrow=0
p_index = 0
match_start_index = 0
match_start_buf=0
s_index = -1
#だめ　無限ループ
while s_index < len(s)-1:
  s_index+=1
  if s[s_index] == p[p_index]:
    if p_index == 0:
      match_start_index = s_index
    p_index += 1
    cnt_match_inrow += 1
    if cnt_match_inrow == len(p):
      print('Yes')
      break
  else:
    p_index = 0
    s_index -= cnt_match_inrow
    cnt_match_inrow = 0
else:
  print('No')

Submission status: Accepted

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

s += s

if s.find(p) >= 0:
    print('Yes')
elif s.find(p) < 0:
    print('No')

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    s = input().rstrip()
    t = input().rstrip()
    
    for i in range(len(s)):
        temp_word = ""
        for k in range(len(t)):
            if i + k <= len(s)-1:
                temp_word += s[i + k]
            else:
                temp_word += s[i + k - len(s)]
        if temp_word == t:
            print("Yes")
            sys.exit()
    
    print("No")
    
    
if __name__ == "__main__":
    main()

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:
def run():
    first_line=input()
    second_line=input()
    
    virt_line=first_line+first_line[0:len(second_line)]
    find_flag=False
    for i in range(len(first_line)):
        same=True
        for j in range(len(second_line)):
            
            if second_line[j] != virt_line[i+j]:
                same=False
            
        if same is True:
            find_flag=True
            
    if find_flag:
        print("Yes")
    else:
        print("No")

run()

Submission status: Accepted

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

ss = s + s
l = len(p)

result = "No"

for idx, e in  enumerate(ss):
    
    if idx > len(s):
        break
    
    if ss[idx:l+idx] == p:
        result = "Yes"
        break

print(result)

Submission status: Accepted

Solution code:
s1,s2=input(),input()
s3=s1+s1

if s2 in s3:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
s = input()
p = input()
result = 'No'
for i in range(len(s)):
    target = s[i:] + s[:i]
    if p in target:
        result = 'Yes'
        break

print(result)

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()
s*=2

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

Submission status: Accepted

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

if p in t:
    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*2
if p in s:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

ss=s*2

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

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:
#1_8_D
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*2
if S.find(p)==-1:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
s += s * 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:
# coding: utf-8
# 58

s = input()
p = input()

if s.count(p)>0:
    print('Yes')
else:
    S = s+s

    if S.count(p)>0:
        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()

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

Submission status: Accepted

Solution code:
import re

n = input()
m = input()

l = n + n
s = re.search(m, l)

if s != None:
    print('Yes')

else:
    print('No')

Submission status: Accepted

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

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()

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

Submission status: Accepted

Solution code:
s = input()
p = input()
t = s[0:-1]
s += t

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

S = s+s

i = S.find(p)

if i>=0 :
    print('Yes')
if i==-1:
    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()
P = input()
S += S
if P in S:
    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:
p = [x for x in input()]
p_len = len(p)
s = input()

for i in range(p_len):
    jadge_string = "".join(p)
    if s in jadge_string:
        print("Yes")
        break
    elif i == p_len-1:
        print("No")
    else:
        c = p.pop(0)
        p.append(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
b = input()

c = a + a

if b in c:
    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:
x=input()
y=input()
a=x*2
if y in a:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

def get_ring(index):
    global s
    for _ in range(len(s)):
        yield s[index]
        
        if index < len(s) - 1:
            index += 1
        else:
            index = 0
            
for i in range(len(s)):
    if s[i] != p[0]:
        continue
    
    off = 0
    for char in get_ring(i):
        if p[off] != char:
            break
        off += 1
        if off == len(p):
            break
        
    if off == len(p):
        print("Yes")
        break
    
else:
    print("No")

Submission status: Accepted

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

t = s*2

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

Submission status: Accepted

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

Submission status: Accepted

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

s_charlist = list(s)
s_length = len(s)
p_length = len(p)
p_head = p[0]

msg = 'No'
for i in range(s_length):
    if p_head == s[i]:
        ans = ''
        if s_length - i < p_length:
            ans = ''.join(s_charlist[i:]) + ''.join(s_charlist[:p_length - (s_length - i) ])
        else:
            ans = ''.join(s_charlist[i:i + p_length])
        if ans == p:
            msg = 'Yes'
            break

print(msg)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
p = input()
l = len(p)
flg = 0
S = s*2

for i in range(len(s)):
    if S[i:i+l] == p:
        print('Yes')
        flg = 1
        break

if flg == 0:
    print('No')

Submission status: Accepted

Solution code:
s = input()
p = input()
for i, c in enumerate(s):
    is_valid = False
    if c == p[0]:
        if len(p) == 1:
            print('Yes')
            break
        else:
            for j in range(1, len(p)):
                i += 1
                if i >= len(s):
                    i -= len(s)
                if s[i] != p[j]:
                    break
                else:
                    if j == len(p) - 1:
                        is_valid = True
    if is_valid == True:
        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:
s = input()*2
p = input()
if p in s:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
sinp = input()  # s=abkckeoekdslsl
sinp = sinp + sinp
pinp = input()  # p=ceks

if sinp.count(pinp) != 0:
	print('Yes')
else:
	print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

s_list = []
for i in range(len(s)):
    new_s = s[i:] + s[0:i]
    s_list.append(new_s)

exist = False


for ss in s_list:
    if r in ss:
        exist = True

if exist:
    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()

sloop = s + s[0:len(p)]

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

Submission status: Accepted

Solution code:
S = input()
P = input()
SS = S + S

print('Yes') if SS.count(P) > 0 else print('No')

Submission status: Accepted

Solution code:
import sys

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

  len_s = len(s)
  can_make = False

  for i in range(len_s):
    first = s[0:i]
    second = s[i:]
    str = second + first

    if p in str:
      can_make = True
      break
  
  if can_make:
    print('Yes')
  else:
    print('No')

if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

s_2=s+s

if p in s_2:
    print('Yes')
else:
    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()
judge = 0

for i in range(0, len(s)):
    s_double = s + s
    if p in s_double:
        judge += 1

if judge != 0:
    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()
f = input()
s = s + s
if f 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()

ss = s + s
if len(p) > len(s):
    print('No')
elif p in ss:
    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:
n=input()
m=input()
lon=n+n
for i in range(len(n)):
    if lon[i:i+len(m)]==m:
        print("Yes")
        break
    if i==len(n)-1:
        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:

string_ring = list(input())
string = list(input())

length_ring = len(string_ring)
length_str = len(string)
l = 1
check = False
flag = 0
for i in range(length_ring):
    if string_ring[i] == string[0]:
        k = i
        l = 1
        for j in range(1, length_str):
            flag = 1
            if k + l == length_ring:
                k = 0
                l = 0
            if string_ring[k + l] != string[j]:
                break
            l += 1
            if j == length_str - 1:
                check = True
                break
        if flag != 1:
            check = True
        if check:
            break

if check == False:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
n = input()
m = n + n
l = input()
if l in m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
u = input()
w = s*2

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

Submission status: Accepted

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

index = int(len(s)/2)
forward = s[:index]
back = s[index:]

ring = back + s + forward

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

Submission status: Accepted

Solution code:
ring = str(input())
request = str(input())
flg = False

for x in range(len(ring)):
    s = ring[x:x+1] 
    t = request[0:1]
    if ring[x:x+1] == request[0:1]:
        cn = 1
        
        if len(request) == 1:
            flg = True
            break

        for y in range(x+1, len(ring)+x+1):
            a = y % len(ring)
            b = ring[a:a+1]
            c = request[cn:cn+1]

            if b != c:
                break
            cn +=1
        if cn == len(request):
            flg = True

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

Submission status: Accepted

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

s =  s + s

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

Submission status: Accepted

Solution code:
ring = input()
text = input()
w_ring =ring + ring

if text in w_ring:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ring_base += ring_base
if target in ring_base:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
p = input()
print('Yes' if (s + s).count(p) > 0 else '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()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A = input()
a = len(A)
B = input()
b = len (B)
A = A+A
c = 0
for i in range(a):
    if A[i:i+b] == B:
        c += 1
if c > 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
table1 = input()
table2 = input()
ring = table1 + table1
if ring.count(table2)==0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

f = False

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

                if f == True:
                        break

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    ring_string = input()

    target_string = input()

    answer = 'Yes' if target_string in (ring_string + ring_string) else 'No'

    print(answer)

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()
ss = s*2
t = input()

ans = 0

for i in range(len(ss)-len(t)+1):
    portion = ss[i:i+len(t)]
    if portion == t:
        ans += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

string = S + S

if P in string:
    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_lst = list(input())
p_lst = list(input())
l = len(s_lst)
not_found = True

for i in range(l):
    s = "".join(s_lst)
    p = "".join(p_lst)

    if p in s:
        print("Yes")
        not_found = False
        break
    else:
        t = s_lst[0]
        for j in range(l-1):
            s_lst[j] = s[j+1]
        s_lst[-1] = t

if not_found:
    print("No")

Submission status: Accepted

Solution code:
str=input()
a=input()
str+=str
judge=0
for i in range(len(str)-len(a)):
    b=""
    for j in range(len(a)):
        b+=str[i+j]
    if a==b:
        judge=1
if judge==1:
    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:
a = input()
b = input()
a=a*2
if b in a:
  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:
def main():
    s = input()
    p = input()
    answer = 'Yes' if match(s, p) else 'No'
    print(answer)

def match(s, p):
    for i in range(0, len(s)):
        for j in range(0, len(p)):
            if s[(i + j) % len(s)] != p[j]:
                break
        else:
            return True
    return False

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

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

s += s

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Problem - リング

# input
s = input()
p = input()

# initialization
tmp = s + s

# output
if p in tmp:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ring_str=input()
str=input()
ring=ring_str

if str in ring+ring_str:
    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 = str(input())
p = str(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s, p = [str(input()) for i in range(2)]

new_s = s + s[:-1]

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

Submission status: Accepted

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

x = len(p)

for i in range(len(s)):
    if i + x <= len(s):
        inner = s[i : i + x]
        
    else:
        inner = s[i : ] + s[0: (i + x) - len(s)]
 
    if inner == list(p):
        print("Yes")
        break
        
if inner != list(p):
    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()
m=input()
s+=s
if m 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 = str(input())
ans = str(input())
moji = s + s
if ans in moji:
  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()

s_length = len(s)
char_length = len(p)

s = s*2

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

Submission status: Accepted

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

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

if flg:
    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 math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


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

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===
sentence = input()
s = input()

sentence = sentence+sentence

flg = True
for i in range(len(sentence)-len(s)):
    if sentence[i:i+len(s)] == s:
        print("Yes")
        flg = False
        break
    else:
        continue
        
if flg:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

ss = s + s[:len(p)]

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

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