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: Runtime Error

Solution code:
ring = raw_input() * 2
word = raw_input()

flag = 0
counter = 0
while counter < len(ring/2):
    if ring[counter:counter + len(word)] == word:
        flag = 1
        break

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

Submission status: Runtime Error

Solution code:
input_str = input()
target_str = input()
if target_str in input_str:
    print('Yes')
else:
    ret = ''
    r_str = input_str[::-1]
    idx = r_str.index(target_str[0])
    ret += r_str[idx::-1]
    size = len(target_str) - len(ret)
    ret += input_str[:size]
    if ret == target_str:
        print('Yes')
    else:
        print('No')

Submission status: Runtime Error

Solution code:
input_str = input()
target_str = input()
if target_str in input_str:
    print('Yes')
else:
    ret = ''
    r_str = input_str[::-1]
    try:
        idx = r_str.index(target_str[0])
    except ValueError:
        print('No')
    ret += r_str[idx::-1]
    size = len(target_str) - len(ret)
    ret += input_str[:size]
    if ret == target_str:
        print('Yes')
    else:
        print('No')

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import sys
#t=1

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

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

Submission status: Runtime Error

Solution code:
import sys

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

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

Submission status: Runtime Error

Solution code:
s = list(input())
p = list(input())
#print(len(p))
import sys
t=0

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

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

fori

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
sam = input()
ans = input()
for i in range(1,len(ans)) :
    if (ans[:i] in sam) == False : break
if ((ans[i - 1 :]) in sam) == True : print('Yes')
else                             : print('No')

Submission status: Runtime Error

Solution code:
sam = input()
ans = input()
for i in range(len(ans)) :
    if (ans[:i] in sam) == False : break

print(ans[ :i-1])
print(ans[i-1:])
print(sam[:len(ans[i-1:])])

if   ((ans[i - 1 :]) in sam[:len(ans[i-1:])])== True and len(ans) != 1 : print('Yes')
elif (ans in sam) == True                                      : print('Yes') 
else                                                           : print('No')                                                 : print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(len(s)):
    if i == 0 and ring_str.find(s) != -1:
        print('Yes')
        break
    if i != 0 and ring_str.find(s[:i]) == len(ring_str) - len(s[:i]):
        if s[i:] == ring_str[:len(s[i:])]:
            print('Yes')
            break
    if i == len(s) - 1:
        print('No')

Submission status: Runtime Error

Solution code:
p,s=[input() for i in range(2)]
p=p*100
if a in p:
    print('Yes')
else:
    print('NO')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

from bisect import bisect_left, bisect_right, insort_left
dict = {}
keytbl = []
q = int(input())
for i in range(q):
	a = list(input().split())
	ki = a[1]
	if a[0] == '0':
		if ki not in dict:
			dict[ki] = []
			insort_left(keytbl, ki)
		dict[ki].append(int(a[2]))
	elif a[0] == '1':
		if ki in dict and dict[ki] != []: print(*dict[ki], sep='\n')
	elif a[0] == '2':
		if ki in dict: dict[ki] = []
	else:
		L = bisect_left (keytbl, a[1])
		R = bisect_right(keytbl, a[2], L)
		for j in range(L, R):
			for k in dict[keytbl[j]]: print(keytbl[j], k)