Problem:
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

Solution (Python):
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)

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

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

Solution (Python):
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')

Solution (Python):
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')

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

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

Solution (Python):
sinp = input()  
sinp = sinp + sinp
pinp = input()  

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

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

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

Solution (Python):
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")

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

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

Solution (Python):
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")

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

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

Solution (Python):
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()

Solution (Python):
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")

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

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

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

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

s_2=s+s

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

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

Solution (Python):
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")

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

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

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

S = s * 2

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

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

ss = s + s
if len(p) > len(s):
    print('No')
elif p in ss:
    print('Yes')
else:
    print('No')

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

s *= 2

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

Solution (Python):
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")

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

s += s

if p in s:
    print("Yes")

else:
    print("No")

Solution (Python):

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

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

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

if u in w:
    print('Yes')
else:
    print('No')

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

s=s*2

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

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

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

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

Solution (Python):
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")

Solution (Python):
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')

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

s =  s + s

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
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")

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

Solution (Python):
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")

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

    target_string = input()

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

    print(answer)

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

Solution (Python):
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')

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

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

string = S + S

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

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

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

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

Solution (Python):
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")

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

Solution (Python):
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")

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

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

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

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

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

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

Solution (Python):
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()

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

s = s + s

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

Solution (Python):
import sys

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

s += s

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

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

Solution (Python):



s = input()
p = input()


tmp = s + s


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

Solution (Python):
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)

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

if str in ring+ring_str:
    print("Yes")
else:
    print("No")

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

Solution (Python):
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)

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

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

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

new_s = s + s[:-1]

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

Solution (Python):
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")

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

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

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

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

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

Solution (Python):
s = str(input())
ans = str(input())
moji = s + s
if ans in moji:
  print("Yes")
else:
  print("No")

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

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

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

Solution (Python):
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")

Solution (Python):
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")

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

Solution (Python):
import math
import copy
from copy import deepcopy
import sys
import fractions

from functools import reduce

import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)







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



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

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

Solution (Python):
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')

Solution (Python):
import re
s = input()
p = input()
ss = s+s
if re.findall(p,ss):
    print('Yes')
else:
    print('No')

Solution (Python):
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)

Solution (Python):
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()

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

ring = ring * 2

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

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

Solution (Python):

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

Solution (Python):
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")

Solution (Python):
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")

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

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

Solution (Python):
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")

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

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

Solution (Python):
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')

Solution (Python):
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')

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

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

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

Solution (Python):
sen=input()
sen_2=sen+sen
word=input()
if word in sen_2:
    print('Yes')
else:
    print('No')

Solution (Python):
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')

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

Solution (Python):
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)

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

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

s+=s


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

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

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

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

Solution (Python):
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")

Solution (Python):
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")

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

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

Solution (Python):
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))

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

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

Solution (Python):
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')

Solution (Python):
import sys
import itertools
import math



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

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

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


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

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

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

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

Solution (Python):

import sys



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

Solution (Python):
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)

Solution (Python):
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")

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

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

Solution (Python):
s = input() * 2

p = input()

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

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

Solution (Python):
*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)

Solution (Python):
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')

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

Solution (Python):
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")

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

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


searching = True
s_index = 0;
p_index = 0;

loop = False

while searching:
    
    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

Solution (Python):
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)
        
        if txt[ring_idx] != target[j]:
            break
        else:
            cnt += 1

    if cnt==len(target):
        
        
        print('Yes')
        flg = 1
        break


if not flg:
    print('No')

Solution (Python):
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")

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

Solution (Python):
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")

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

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

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

Solution (Python):
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')

Solution (Python):
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")

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

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

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

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

Solution (Python):
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")

Solution (Python):

check_data = input().lower()*2
juge_data = input().lower()


if juge_data in check_data:
    print("Yes")
else:
    print("No")

Solution (Python):
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")

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

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

Solution (Python):
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")

Solution (Python):
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')

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

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

Solution (Python):
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")

Solution (Python):
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')

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

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

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

Solution (Python):

s = input()


p = input()


s2 = s * 2


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

Solution (Python):
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)

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

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

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

Solution (Python):

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]

        

        if p in new_s:
            res = "Yes"

    print(res)

if __name__ == "__main__":

    s = input()
    p = input()

    find_pattern(s, p)

Solution (Python):
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")

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

Solution (Python):
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)

Solution (Python):
src = input() * 2

target = input()

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

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

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

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

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

ss = s + s


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

Solution (Python):
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")

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

Solution (Python):
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')

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

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

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

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

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

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

Solution (Python):
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')