Write a program to find a pattern $p$ in a ring-shaped text $s$. The input consists of the text $s$ and the pattern $p$. If $p$ is found in $s`, output "Yes"; otherwise, output "No". The length of $p$ is at least 1 and at most 100, and both $s$ and $p$ consist of lowercase letters.

# Buggy version:
print("Yes" if 2*input().find(input()) > -1 else "No")



# Fixed version:
print("Yes") if (input()*2).find(input())>-1 else print("No")

# Buggy version:
# 18-Character-Ring.py

# ????????°
# ???????????????????????°??¶???????????? s ???????????????????????????????¨????????????£?¶????????????????????????????????????§???
# ????????? p ??????????????????????????????????????°????????????????????????????????????

# Input
# ????????????????????? s ????????????????????????
# ????????????????????? p ????????????????????????

# Output
# p ??????????????´?????? Yes ??¨?????????????????´?????? No ??¨????????????????????????????????????

# Constraints
# 1???p????????????s????????????100
# ??????????????±?°???????????????????

# Sample Input 1
# vanceknowledgetoad
# advance
# Sample Output 1
# Yes

# Sample Input 2
# vanceknowledgetoad
# advanced
# Sample Output 2
# No

import re

pattern=[]

s=input()
p=input()

s= s+s

for p2 in list(p):
	pattern.append(p2)
	pattern.append(".*")

pattern = "".join(pattern)
print(pattern)

matchOB = re.search(p, s)

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

# Fixed version:
# 18-Character-Ring.py

# ????????°
# ???????????????????????°??¶???????????? s ???????????????????????????????¨????????????£?¶????????????????????????????????????§???
# ????????? p ??????????????????????????????????????°????????????????????????????????????

# Input
# ????????????????????? s ????????????????????????
# ????????????????????? p ????????????????????????

# Output
# p ??????????????´?????? Yes ??¨?????????????????´?????? No ??¨????????????????????????????????????

# Constraints
# 1???p????????????s????????????100
# ??????????????±?°???????????????????

# Sample Input 1
# vanceknowledgetoad
# advance
# Sample Output 1
# Yes

# Sample Input 2
# vanceknowledgetoad
# advanced
# Sample Output 2
# No

import re

pattern=[]

s=input()
p=input()

s= s+s

# for p2 in list(p):
# 	pattern.append(p2)
# 	pattern.append(".*")

# pattern = "".join(pattern)
# print(pattern)

matchOB = re.search(p, s)

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

# Buggy version:
s = input()
P = input()
e = s + s
x = len(P)
m = 0
count = 0
for i in range(len(s)):
    if P == e[m:x]:
        count += 1
    m += 1
    x += 1
    if count >= 1:
        print("Yes")
    else:
        print("No")

# Fixed version:
s = input()
P = input()
e = s + s
x = len(P)
m = 0
count = 0
for i in range(len(s)):
    if P == e[m:x]:
        count += 1
    m += 1
    x += 1
if count >= 1:
    print("Yes")
else:
    print("No")

# Buggy version:
# coding: utf-8
s = input() * 2
p = input()
if s.find(p):
    print("Yes")
else:
    print("No")

# Fixed version:
# coding: utf-8
s = input() * 2
p = input()
if s.find(p) >= 0:
    print("Yes")
else:
    print("No")

# Buggy version:
s1 = input()
s2 = input()

if s2 in s1+s1:
    print("Yes")
else
    print("No")

# Fixed version:
s1 = input()
s2 = input()

if s2 in s1+s1:
    print("Yes")
else:
    print("No")

# Buggy version:
import sys

lines = [line for line in sys.stdin]
s = lines[0] + lines[0]
p = lines[1]
if s.find(p) != -1:
    print('Yes')
else:
    print('No')

# Fixed version:
import sys

lines = [line.strip() for line in sys.stdin]
s = lines[0] + lines[0]
p = lines[1].strip()

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

# Buggy version:
import sys

for i in range(len(s)):
	for j in range(len(p)):
		t=0
		if p[j] == s[(i+j)%len(s)]:
			t = t+1
			#print(p[j], s[(i+j)%len(s)])
		else:
			t = 0
		if t == len(p):
			print('Yes')
			sys.exit()

if t < len(p):
	print('No')

# Fixed version:
s = list(input())
p = list(input())
#print(len(p))
import sys

for i in range(len(s)):
	t=0
	for j in range(len(p)):
		if p[j] == s[(i+j)%len(s)]:
			t = t+1
			#print(p[j], s[(i+j)%len(s)])
		else:
			t = 0
		if t == len(p):
			print('Yes')
			sys.exit()

if t < len(p):
	print('No')

# Buggy version:
s=input()*3
print(s)
if s.find(input()) == -1 :
    print('No')
else:
    print('Yes')

# Fixed version:
s=input()*3
if s.find(input()) == -1 :
    print('No')
else:
    print('Yes')

# Buggy version:
z=input()*2
x=input()
a=z.count(x)
print(a)
if a>=1:
    print("Yes")
else:
    print('No')

# Fixed version:
z=input()*2
x=input()
a=z.count(x)

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

# Buggy version:
s = input()
p = input()
Ans = False

for i in range(len(s)):
    for j in range(len(p)):
        if i + j >= len(s):
            i = -j
        if s[i + j] != p[j]:
            break
    if j == len(p) - 1:
        Ans = True
        break

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

# Fixed version:
s = input()
p = input()
Ans = False
cnt = 0

for i in range(len(s)):
    for j in range(len(p)):
        if i + j >= len(s):
            i = -j
        if s[i + j] != p[j]:
            break
        cnt += 1
    if cnt == len(p):
        Ans = True
        break
    cnt = 0

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

# Buggy version:
s,p=[input() for i in range(2)]
s=s*100
if p in s:
    print('Yes')
else:
    print('NO')

# Fixed version:
s,p=[input() for i in range(2)]
s=s*100
if p in s:
    print('Yes')
else:
    print('No')

# Buggy version:
letters=input()
letters=letters+letters
want_find=input()
print(letters)
if want_find in letters:
    print('Yes')
else:
    print('No')

# Fixed version:
letters=input()
letters=letters+letters
want_find=input()
if want_find in letters:
    print('Yes')
else:
    print('No')

# Buggy version:
i=input
p=print
x=i()
y=i()
(x+x).count(y) if p('Yes') else p('No')

# Fixed version:
i=input
p=print
x=i()
y=i()
p('Yes') if (x+x).count(y) else p('No')

# Buggy version:
s = input()
s += s
print(s)

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

# Fixed version:
s = input()
s += s

key = input()

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

# Buggy version:
# -*- coding: utf-8 -*-

import sys

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

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


# Fixed version:
# -*- coding: utf-8 -*-

import sys

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

s += s

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

# Buggy version:
# AOJ ITP1_8_D

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

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

if __name__ == "__main__":
    main()


# Fixed version:
# AOJ ITP1_8_D

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

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

if __name__ == "__main__":
    main()

# Buggy version:
# Ring

ring = input()
word = input()

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

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



# Fixed version:
# Ring

ring = input()
word = input()

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

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

# Buggy version:
i=input
p=print
s=i()
p=i()
(s+s).count(p) if p('Yes') else p('No')

# Fixed version:
s = input()
p = input()
s = s+s
print('Yes' if s.count(p) else 'No')

# Buggy version:
s = str(input())
p = str(input())
case = s + s
if p in case == True:
	print('Yes')
else:
	print('No')


# Fixed version:
s = str(input())
s = s + s 
p = str(input())

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

# Buggy version:
s = print()
p = print()

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

# Fixed version:
s = input()
p = input()
s *= 2

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

# Buggy version:
s = input()
p = input()
????
s += s[:len(p)]
if p in s:
????????print("Yes")
else:
????????print("No")

# Fixed version:
s = input()
p = input()
s = s + s[:len(p)]
if p in s:
    print('Yes')
else:
    print('No')

# Buggy version:
s=input()
p=input()

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

# Fixed version:
s = input()
p = input()

s = s + s

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

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


# Fixed version:
s = input()
p = input()

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