Problem:


Score : 200 points

Problem Statement

You are given string S and T consisting of lowercase English letters.

Determine if S equals T after rotation.

That is, determine if S equals T after the following operation is performed some number of times:

Operation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.

Here, |X| denotes the length of the string X.

Constraints

2 \leq |S| \leq 100

|S| = |T|

S and T consist of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S
T

Output

If S equals T after rotation, print Yes; if it does not, print No.

Sample Input 1

kyoto
tokyo

Sample Output 1

Yes

In the first operation, kyoto becomes okyot.

In the second operation, okyot becomes tokyo.

Sample Input 2

abc
arc

Sample Output 2

No

abc does not equal arc after any number of operations.

Sample Input 3

aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Sample Output 3

Yes



Sample input:
kyoto
tokyo


Sample output:
Yes

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
flg=1
for i in range(len(s)):
    flg=1
    for j in range(len(s)):
        num = i+j

        if num >= len(s):
            num -= len(s)

        if s[num] != t[j]:
            flg=0
            break
    
    if flg==1:
        break

if flg==1:
    print("Yes")
else:
    print("No")
    

    





# ??!~<<??11z<<<<<+(J+gQWHMMMHHHHUUUVVz<<<<1OOOOXWWkqHHHHHHHkqkqHHkqHHHHHHHkHHHUHHHHHHHHWWWWWWWWWWWWWWUUUVVOOOOOOOOOOOOOOOOOwZXVwVZZZOOOOOOz<<<<<<<<<<<<
#  ......-_(JgXVB9UUZyyyyWWyVVyWXzvrI<::++z+1zOXfWkkkkkkkkkkkkkkkkkbkbbbbbppHo(dppppfffffVVVVyyyyyyyZZuvrrttttttv1llllllllztrZ!_?rttttttll?;;;;;;::~~~~~
# yUUUUUUWVVk&++?zOwXuuuvvXyVyZuuzZv~~~``~!  (OXkkqkkkkkkkkkkkkkkkkkkkbbbbbbbWbppppf?77T4pVfVVVVyyyyZuvrrttttttt>(ttttlltrrvZ:_-Jrrrtttllz>;;;;;;::~~~~~
# .........-?74WyXx<zOOwrrzuuuuz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VfWfVVVVyVWkVY=<_........`.....-_?7TXwwtttlOw+.?4yyyyZyZyyyyyyyyyyZZZZZZZuzOtttrrrttz==??1zrrvvrrrr
# XyVyVyyW+ ?! JVyn..WVW_(yWuZyWppppbkbkkkHHWyyVWHVVVWHWffWWVY>_~.........``.`..`.`.`.....` ?7CwZvXXx-.?WyyyyyVVVyyyyyyyyyXZZuXZtrrrrrrrtll==zzvzzzzzvvr
# _______._  ..~___` (VW}.VWZXWfpppbbbkkHHyyyVWHHVVVWHWWXY>:~~~~........`.......``.`````````.`..-?CXZkz+.?WyVVVVVVVyyyyyyWsdZXrtrvzzzzvttlllzwzzzuzzzzzv
# yVVVyVyyC .yyWY``.dVVV}.VVVfpppppbpbWHyyyyWWHVVVVWHKY<::::::~~~~...-----(((((J(-(......`.`..`.._..?4XAz<.?WfffVVVVVyyyyyZZXrrrzzuuzzrrtttOwuuuuuuuzzzz
# OVyVyVVf (VWY``.dVyyVW!.fWfpfppppbWHWyyyyWHHVVVVVH3_::::::::((J&QWHHHWHUkyZZZyyyXXWkXXUUX&J-........_Tkz+i.CWpffVVyVVyyyZuvvzuuuuuzzvrrrvzuuuuuuuuuzzv
#  OVyVVf`-WY``.uWVyVVV$ dyffpfppWpWHyyyyVWHHVVfVfWC::::::(+dHHHffVffffWNkWyWZZZZZZwXXkwrwvZWkZUG--~~.~_14yz<.,WpWffVVVVyZ0zzuuuZuuuzzzvvzuuZuuuuuuuuuzz
# +.UyyS!.Y!`.JyVVyVyy0~.VyWffppfpHWyyyyyWHMVVfffpHI::++gHHfWHpfffVfWfVXHkXkWXZXXOOuZOXkOlzrrXWzvwZUa,~._1vk1?- 7WWffVVyWXuuuZZZZZuuuuzuuuZZZZZZZZuuuuuu
# _!.WX!,!`.JVyWyVyVy0!.XVVVVffpWHXyyyyVWgMVffffWWUijdMHppppWpVVVWZWWXXZHHkXWwXZOz=OI?wuO<;1rtZWzZOwrZW&-_1?kl(-`(WpfVyyuuZZZyZZZZZXZuXXXXyyZZZ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
# trrrrrvvzzzzzuzuuuuZXWHWWHVyVWZpH@HNppppppHuWH@@MMbkHHMWHu+NMMMNkC` ~<jWh_THyWkkWMMMHWMppbWHMWMWNJ.(<?kVWVyyykdHkyyZZHkWkXZuuXXkXkO===??+__ ?<+<<;;;;<
# ???OrrrvvzzzuzuuuuuXXqHVWNfVfVypH@HMpppppbpWXH@@MkbkHMNHMNNMN#K79NZ.` ~._T&_?TWHkbbHMMHbWWdMMMMMTM#N,_XfWkVVWSyWHyyyyXHHWkZZZXkUkzzrwOzz1<<<-.`_<+:___
# <>??1zOrrvzwZ7?TuXWXqmHVWMffffVfWHM@WbppbbbWXWH@MkkWMMNMMMMNMMNp__==``   ``.?<.__<79WWHHOMNfMNNMN/(WMNJHWHWfWdVWHyyyyZXHq$<wZZWZOXtzztltOOO&+_~~.-_<_`
# ;<1=zttrOIz____..7WHmgHVfMpWfpfpWMMMHbpbWHbbppMHMkHMMMMNWMMNMMMN.` `        `   ``.JHY77HMMMMMMMM@ _7HHJNWHWSXVWHWVyyXXXHqWkyZXSrOwOtzvzlll1+?1&-<<__-
# ++1=ltrrrvwzz<__._(UmgHVVMfWXpppbMM@NpppbHWbppWHNHHMH1M#MMqMMHHM{     `    `  `  ?"!   .NBW9TGdHMN. _dHv?HWHdfffWHWWVyWXWHqqkyXdkrrZwtlO++1z1=?<<+i+1(
# ztltttrrrrrvvOx<___~ZgHVVMpfXfpppM@@MWbbbWNbkbbM@BM@!.##"4C?HKjM{ ` `  ` ` `  ``  `  ``.{`.Ngv9TH#`  .g]__WdMWfffHWHVVVVkUWHqkXvWkwrrXOl==1+<?<<<<<77?
# JltttttttrrOdHXHgQWHgHHVV@WpXpfppH@@@HbbbbHHbkHHPJ#_  W` dBB6jWY `   `    `     -       ?Hm+-JadgF ` JH' _d@NMkpfHkWkfVVfWy4WqHywWWwvwZXz==z1:` `  ..(
# llllllltOOwWXHmmmmmmHMfff@HpZppppWM@@NHbkkW@HkkbHJW+` .WkmJvY"=!`` `  ` `  `` __< ` `  ```` _?TC=``.7!` .(HW@HHkfWHWHkfffVfWsVWHkXkOXwrOtZwv!.-_-_~(dz
# lllltlzlOdWWqHHmmmHMgHfffMHpZpfpppM@@MHbWbkH@HkkbH/_7  .7_...````````  `     ` _( `  ` ``````.``````   .`jHWHM@MkfWWHgkfpfWHkWAvWWWOtlOXwwv<(:(<((jwZX
# zllzlOGdWWkH@HmHHgmHgHffWMHpyfpfppHMM>HHkkHHH@HkkWH,`...........``````  `` `    `  `  `````` ....... .``.HpWH@H@MHWHHHHHfppfWHHkkzUktltlzI+&z+<?CdSXXX
# lzugkHbHHWHHH9AHHHVWg@ffWMHpZpppppWHD:?HpbbHkHMNbbHH,._....._.._.```` `  ` `  `   ` ` ` ``` _`-.........WpWH@H@@HMNHHWH@HWfpfffWHHkJSZzlll==zTXy+-?XWH
# HkWHHWkHBUOltdHVVVWggMfpM@HpXpfppfpMb~vWbbbkHbHH@HkbH&_.....~....````` `  `  `  `   `  ``````..`_..-_..XWHH@@@H@@H@NqpWH@MHpfpWWXWHHkXyOll==z=uXWkkXZW
# WWU90llllltzdVVyVVHgM#fWMHHfXppppWWHN_>XkbbpWNpHHMVbkkh-.......`.```` ` `  `  `  ` ` ` `````````.`....WWDdM@H@@g@H@NMkpM@@HMkpffWXZWgHXkttltuWqHqHHHWX
# _?TwzzlttldWXyVyVWHNMffWMHHWXffppWXWMp~dHbbppWHbHHb~7WkHe-` `````````  ` ` ` ` ` `    `   ````````` (X=J<H@@@@Mg@M@MMMWW@@@@@MkWfWXvUHHkWwgmmHgHHWUIzz
# ::::<zyOdWXyyVyVWgHHNfWHMHHRWppppWXWMMxJWHppppWHpHH_`._74Wm..``````  ` `  ` ``  ` ``     `  ` `` `.7!`.%(M@@@@HHHWMMH@NW@HmH@MHHkpkXzvWHHHHHBBUWS&O==l
# ::::;:(7kyyyVVVWgHMMHWMM@gpSppfVVSdpMHMgWMWpppfWNbWR.` _ `  _?``` ` ` ` ` `  .... ` `` `  `  `  `  `  Z(@Hg@g@qq#X@@@@MH@mmg@MMgHHkkz1zWHHHWWXuuuXww0y
# :;;:;;:;<4WyVVWkHMM#XWMMggWdWyfXX0dpHHMMWHNpppWWHMHH.?i-`` ``    `  `  ` `.Z1;;<1Zl   ` `  `  `   ` `(ggggqmgHkWSHHHgg@gHqqqHHSXuvwHWyOwWHgKWkXZuuuuuw
# XA&+<;;;;<vWyWHMMkY1WMMMHHSX0XWzwIdpHMHMHHHNpppWXWMHb ` ?<.`` ` `  ` `   (>;;;;;;;d:  `  `  `  `` ` .HgHmHHqqpbKdWmqmmgHHHHWVVyXkmHSdWWyXyHNz=zVWkZXkV
# XwZXWHex>+>?HgMMH[ .dMMMgHXSzXWXwIdpWM@MHWHMNppfWZWMH[  ` (- ` ` `  ` ` `u+;;;;:;+2 `  ` ` ` `  _` .HqqqHpkHHfKwSXkkqqHHWffWWWHHqqHOlzWfVyVHZ====1f'``
# Zy0XXWWVWez=zHHHM#AdMHHgHHdXZWWkwIdfH@MMNW@NWHfVyXOWMH;  ` ..  `  `  ` `  ?<+<<<?``  `  ` ` ` ``` .HHqkHfWWYT77!???7"TWWkWHbHMmkkq6lllzWWVyWb=z=z^``
# UOwyWXXXVWMmyzW@MVVW@@MggSfZWWWkXIXfMMMMNpHNpWHfkwOwXWHx.   _`  ` ` ` ` `` `` .`   `  `   `  `  .dkWHWHV= .!`      ` _._(zTYY9YUW0yuzzlzWyyWH?12``  `
# XyWWSwVyWWgmNWHWHVWM@@MHHXfyVWHWXlXfMMHpHfWMpHMNWkwOwZWNe-.`` ` `  ` `  `  `` _`` `` ` ` `  ``.dHWWpWV! .!`      ` .-~~        `  `` _Tx=WyWWz^``  `.(
# WHSwXVfWgggH@@HHXWHM@HMHXHVVVWHykzVWHpppHWfH@@@HMHfkXZAXWmV&-. ` ``  ` `  `      `  ` ` ``` .dmHHkpK!  .`    `   ``          `          ?wHWY``  ` (::
# WXXVVWHgggH@MgHHWWHbWkHSHHVVyWHy0dVWHbbpWkWWHMM@@@NkffWWwWWHeVu.. ` `  ` `  ` ` ` ` ` `` .JgHHmqqY:   .`                  `   .._________~(^   ` .(;;<
# XWyWHgmgH@MggHMHyHNkbpHXmHyVyHHVkdVWWHkMHNVWM@@@MH@MNWppWkXHHHWxvO+. ``  ` ` ` ` ` ```.(HMHHMNH@<`    _`                ` ..JdWHHHHHHmgJ_J`  ` _<1<<+1
# yWWHHHHMHggg@@MyWH@@M#dmgHVyyHNySXyWM@MMMMXVM@HH@@@@@MNkpfpffpVWHmx+7z-.``` ` `` ` .J=<J@@@@MHD_   ` .           `  ` ` .dWZyWyWQkWkWW@H#`` `  _:<O=uS
# WggmNJMgggH@@HMyX@@@MdMMmHWyyWNyyyyH@@@@HMKVHH@M@@@@@$cdNkppppWhJWWW+;:<71-. `  .JC<:::(MMMHH@_    ` _`  `  `     `   (XZZyyWkY>~_`__:+?%``  `  _:<zSz
# ggggggggg@@HM@@VXMHMX@@NWmHyyWHWyyyWgg@@HHNWWMM@@@@@@g@HH@MkfpppHs+TkW+<:::(??7C(::::::<zdkHM~       :  `      `    (dXyyyWWY~ `  .(<! ._ ` ` `  _:<Oy
# mggggmgg@MM@@@HHWM#X@@@@HHqkyWHHyZyWHHHkHHMHWMg@@Hgg@g@@@@@MMkpHkWh<?UWe<::::::::::::::(dkkH%     ` ._   .    ` ` _(HfpfWW9~    .(!`  ` 1``  `    _::O
# ggmmgmHM@@@HH#WkXBd@@gHHHXqHkXqNyyyXHWHMgggMWWHHqggHg@ggg@HMMMNkWHWW<:?Wn:::::::~::~::(dbkHF       `._  .~    ` .(XHkbbW#>` ``./!   `  ` l ` `     ~::
# gmmgmH@@@HHY3jHMSHHqqkHHHHXHHkWHHyZXSdHHggg@NyHWgggHMggggHM@MM8VWWHHW_:?W<::~::~::::~_dpkbK``  `   ` ;` ~~     _JdHWkHH@:` ` .``  `` `  ` ?+. ....._::
# mmmHH@@@M9>_+MHWHWHHHHHkkHqXHqXqHkyWWggggHHHHNXMHHMgmgggMH@M9Izd?WWMHh:~Jr:::::::~~``JWpWW\          < .~~ `  (+1WHqHHD<``      `    `` ` `j?&``.`.-<<
# mqH@@HHY<<;jMHXkHHHHmHYY1>>vkWHWkHkyWHggg@gHkWMkMHgHggBMMMMz<<<J<?HWMH[~J<:::~::~`` (HHppP  `     ` `(__::_ `.+1j@@@H#:~`` `` `  ` `  ` `` .I(h.` ..(<
# WHMHW6<<<>jMkqkHgHH9z>>>>??<?WUHkHNkZWHHMgHkkmgHHHVY3<(@@MD<;<<>::?HWMN(>:::::~`  ,jHWppW>    `      .<_:~_` <<+d@@@M$:_  `  ` `` ` `  `  ``.%.o ` .-j
# HMW6;;;><jWHkkHHH9<>1z<???????ZwWqkHkXMMmHbbHBY>_?4n_~W@@MI;:::::::JKWN<::::~`` (~.WVVVWP`    `  `   `<:~:~_(::<d@@@M<::_-.  `      ``  ` `.>`._I.` _d
# NV<;;;;;;dmkH$dH$<<>>>+>>??????+HyWkHkXHmHY>~~~~~:~_?4M@@N<<::::::::HfM<::~` ` /  dVVWVK`    `   _    ._::::_:~(d@H@Hz:::::_.` `  ` ` `` `.2 .~(+v+..H
# $(::;;;;jHHH3;WH;>>>>>>><<~~~~<(HHNkWHHkH_~~~~~~~~~~__HHHHo+<((((_(:dX#~` ` ` (` (WVVWX!  `       __~..<~~::~::(jH@@HR<:::::__ `  `  `  `./ ._(+zwwyWK
# (::::;;:dHH$<;?W+>;::::~~:__- .HHHqHHkUWHk&__.....````dHpbh_   ` ```-H] `  ` _ .JffVWX!             _~__1:~~:~:~(W@MHNz+<:::::__.```` `  c`._<1zwXX9=<
# ::::::<<dHX;;;;;1+;;;;;:_((:~(HHkHHpkH6YOwVWa,..``````,NpbWh:__...   H!  ``-_`.XfffWf`  `     `   ` ` _<(<(~:~~::?M@@MN=1i:::::::___.  ./ .(+zOwXHJ(((
# ::::::::WHP:;;;;;;;;;;;>>>><jHWHWXWWk$(_~._<77T1.```   wWppph<~____ .`` ```..WWWfVX^  `            `   ___<+_<_~:~?H@@@Nzz1+::::::::~_(2 _(+zOwZyWk<?7
# :~::::::dHk::;;:;;;;;;;;>>;jWWUV1KWbH~_<....`````       4WppWHx.` ` !``..(WHpfpWK= `       `           `.~_<<1++~:~<THH@Mmzzz<:::::::<2__(+zwwZyyVWHe+
# ~:~~:::::4Xc::::;:;;:;;;;+dWXX6>dWWHR~~(-..````        ` ?WppWpWHkAAQWHHHpfppWY^              `        `..~~~~(?T&~~~<TMMMMNgd&<<<;<<v ~(+zwXZyyVyVfHH

Submission status: Accepted

Solution code:
import sys
def main():
  S = input()
  T = input()
  lenS = len(S)
  if S == T:
    print("Yes")
    sys.exit()
  for _ in range(lenS):
    tempS = S[-(lenS-1):] + S[0]
    if tempS == T:
      print("Yes")
      sys.exit()
    # print(tempS)
    S = tempS
  print("No")

main()

Submission status: Accepted

Solution code:
# ABC103B - String Rotation
s, t = [input().rstrip() for _ in range(2)]
lst_s = [i for i in s]
lst_t = [i for i in t]

if s == t:
    print("Yes")
else:
    for _ in range(len(s)):
        lst_s.insert(0, lst_s.pop())
        if lst_s == lst_t:
            print("Yes")
            break
    else:
        print("No")

Submission status: Accepted

Solution code:
import sys

S = str(input())
T = str(input())
n = 0

if S == T:
    print('Yes')
    sys.exit()

while n <= len(S) - 1:
    S = S[-1] + S[:-1]
    n += 1
    if S == T:
        print('Yes')
        sys.exit()
        
print('No')

Submission status: Accepted

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

flg = False
for i in range(len(S)):
    if S[i:]+S[:i] == T:
        flg = True
        break
if flg: print('Yes')
else: print('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
def reverse(s):
    return s[-1] + s[0:-1]

count = 0
while True:
    if S == T:
        print("Yes")
        break

    S = reverse(S)
    count += 1
    if count == 1000:
    
        print("No")
        break

Submission status: Accepted

Solution code:
s=input()
t=input()
for i in range(len(s)+1):
    s=s[-1]+s[0:-1]
    if s==t:
        print("Yes")
        break
else:print("No")

Submission status: Accepted

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

for i in range(len(T)):
	#print(T[-i:], T[:-i])
	if S == T[-i:] + T[:-i]:
		print("Yes")
		exit()
print("No")

Submission status: Accepted

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

if S == T:
	print("Yes")
	exit()

for i in range(1, len(T)):
	#print(T[-i:], T[:-i])
	if S == T[-i:] + T[:-i]:
		print("Yes")
		exit()
print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
N = len(S)

f = False
for i in range(N):
  if S == T:
    f = True
  T = T[-1] + T[0:N-1]

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

Submission status: Accepted

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

if S == T:
  print('Yes')
  exit()

#最後の文字以外を、後ろにくっつけていく
nowS = S
for _ in range(len(S)-1):
  nowS = nowS[1:] + nowS[0]
  if nowS == T:
    print('Yes')
    exit()
    
print('No')

Submission status: Accepted

Solution code:
S=input()
T=input()
ans="No"
for i in range(len(S)):
  S=S[1:]+S[0]
  if S==T:
    ans="Yes"
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
S = input()
T = input()

if T in S+S:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def main():
  S = list(input())
  T = input()

  t = ''.join(S)
  if t == T:
    print('Yes')
    return

  for _ in range(len(S)-1):
    last = S[-1]
    S.pop(-1)
    S.insert(0, last)
    t = ''.join(S)
    # print(t, T, t == T)

    if t == T:
      print('Yes')
      return
      
  print('No')
  return

main()

Submission status: Accepted

Solution code:
s=input()
t=input()
for i in range(len(s)):
    if s[i:]+s[:i]==t:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
 
for i in range(len(s)):
    if s == t:
        print('Yes')
        break
    else:
        s_last = s[-1]
        s = s_last + s[0:len(s)-1]
if s != t:
    print('No')

Submission status: Accepted

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


s = input()
t = input()
i = 0
count = 0

while i < len(s):
    s = list(s)
    a = s.pop(0)
    s.append(a)
    s = ''.join(s)

    if s == t:
        count += 1

    i += 1


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

Submission status: Accepted

Solution code:
import sys
S = list(input())
T = list(input())

for i in range(len(S)):
    if S == T:
        print("Yes")
        sys.exit(0)
    S = S[1:] + list(S[0])
print("No")

Submission status: Accepted

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

for i in range(len(S)):
    S = S[-1] + S[:-1]
    if S == T:
        print("Yes")
        quit()

print("No")

Submission status: Accepted

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


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
import sys

l = list(input())
s = list(input())

for i in range(len(l)):
    if l == s:
        print("Yes")
        sys.exit(0)
    l = l[1:]+list(l[0])
print("No")

Submission status: Accepted

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

ans = 'No'
for i in range(len(S)):
    if S == T:
        ans = 'Yes'
        break
    else:
        S = S[1:]+S[0]
print(ans)

Submission status: Accepted

Solution code:
#103

S=input()
T=input()
s=len(S)
if S==T:
    print('Yes')
    exit()
for i in range(s+1):
    S=S[-1]+S[0:s-1]
    if S==T:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

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

ans="No"
for i in range(len(S)):
	S = S[1:] + S[0]
	if S == T:
		ans="Yes"

print(ans)

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
ans = 0
for i in range(len(S)):
  S.insert(0,S[-1])
  del S[-1]
  if S == T:
    ans += 1
print("Yes" if ans != 0 else "No")

Submission status: Accepted

Solution code:
def rot(s):
  ret = s[-1]+s[:-1]
  return ret

s1=input()
s2=input()

tmp=s1
flag=False

for i in range(len(s1)):
  tmp=rot(tmp)
  if tmp == s2:
    flag=True
    
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

for i in range(len(S)):
    if S[i:] + S[:i] == T:
        print('Yes')
        quit()
print('No')

Submission status: Accepted

Solution code:
s=input()
t=input()
count=0
for i in range(len(s)):
  if s!=t:
    count+=1
    s=s[-1]+s[:-1]
  else:
    break
print("No" if count==len(s) else "Yes")

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
n = len(S)
for i in range(n):
    if S == T:
        print('Yes')
        exit()
    string = S[-1]
    S.insert(0, string)
    del S[-1]
print('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
for i in range(len(S)):
    if S[i:] + S[:i] == T:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

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

for i in range(len(S)):
    last = S[-1]
    S = last + S[:-1]
    if S == T:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

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

for i in range(len(S)):
    if T == S[i:] + S[:i]:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
N = ""
flg = False
for i in range(len(S)):
    N = S[i:]+S[:i]
    if N == T:
        flg = True
if flg:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
flg = 0
for i in range(len(S)):
    S = S[-1:] + S[:len(S)-1]
    if S == T:
        flg = 1
if flg == 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
T = input()
for i in range(len(S)):
  if S == T:
    break
  S = S[-1] + S 
  S = S[:-1]
if S == T:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
ans = 'No'
if S == T:
    ans = 'Yes'
for i in range(len(S)):
    S = S[-1] + S
    S = S[:-1]
    if S == T:
        ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
a,b=input(),input()
n=len(a)
for i in range(n):
    a=a[1:]+a[:1]
    if a==b:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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


s = input()
t = input()
i = 0
count = 0

while i < len(s):
    s = list(s)
    a = s.pop(0)
    s.append(a)
    s = ''.join(s)

    if s == t:
        count += 1

    i += 1


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

Submission status: Accepted

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

f = False
for i in range(len(S)):
    if S[-i:]+S[:-i] == T:
        f = True
        break

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

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()

n = len(s)

for i in range(n):
  if s[i:] + s[:i] == t:
    print("Yes")
    sys.exit()

print("No")

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
for i in range(len(S)):
    if (S == T):
        print("Yes")
        exit()
    S.insert(0, S[-1])
    del S[-1]
print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
for i in range(len(S)):
    if S[i] == T[0]:
        new_s = S[i:] + S[:i]
        if new_s == T:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import itertools
import collections
import functools
import math
from queue import Queue
INF = float("inf")


def yes():
    print("Yes")  # type: str


def no():
    print("No")  # type: str


def solve(S: str, T: str):
    for i in range(len(S)):
        kari = S[i:]+S[:i]
        if kari == T:
            yes()
            return
    no()
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
t = input()
s += s
found = False
for i in range(0,len(t)):
    if s[i:i+len(t)] == t:
        found = True
if found :
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
t = input()
size = len(s)
for i in range(size):
    b = s[-1]
    s = s[0:size-1]
    s = b + s
    if s == t:
        print("Yes")
        break
    elif i == size-1:
        print("No")

Submission status: Accepted

Solution code:
S = [i for i in input()]
T = input()
S=S*2
if T in "".join(S):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# 2019/04/08
# AtCoder Beginner Contest 103 - B

# Input
s = input()
t = input()

# Init
ans = "No"

# Trans
for i in range(len(s)+1):
    ws = s[len(s)-1] + s[0:len(s)-1]
    s = ws

    if s == t:
        ans = "Yes"
        break

# Output
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


s, t = IS(), IS()
for i in range(len(s)):
    a = [] 
    for j in range(len(s)):
        a.append(s[(i+j) % len(s)])
        if ''.join(a) == t:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

ok = False
for i in range(len(s)):
  a = s[-1]
  s = s[:-1]
  s.insert(0, a)
  if s == t:
    ok = True
    break
if ok:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
s = str(raw_input())
t = str(raw_input())
if sorted(s) == sorted(t):
	for i in range(len(s)):
		s = s[1:] + s[0]
		if s == t:
			print 'Yes'
			sys.exit()
print 'No'

Submission status: Accepted

Solution code:
S = input()
T = input()
flag = False
for i in range(len(S)):
  if(T == S[i:]+S[:i]):
    flag = True
    break
if(flag):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

for i in range(len(S)):
  if S == T:
    print('Yes')
    break
  
  T = T[1:] + T[0]
  
  
if S != T:
  print('No')

Submission status: Accepted

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

n = len(S)

ans = "No"

for i in range(n):
    m = S[-1]
    S = m + S
    S = S[:-1]
    
    if S == T:
        ans = "Yes"
        break

print(ans)

Submission status: Accepted

Solution code:
S = (input())
T = (input())
for i,c in enumerate(S):
    if T == S[i:] + S[:i]:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
a=list(input())
s=list(input())
b=False
for i in range(len(s)):
  d=a[0]
  del a[0]
  a.append(d)
  if a==s:
    print("Yes")
    b=True
    break
if b==False:
  print("No")

Submission status: Accepted

Solution code:
s=input();t=input();print("YNeos"[all(s[i:]+s[:i]!=t for i in range(len(s)))::2])

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
f = False
for _ in range(len(s)):
    head = s.pop(-1)
    s.insert(0,head)
    if s == t:
        f = True

print('Yes' if f else 'No')

Submission status: Accepted

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

i = 0
while i < len(T):
    S = S[-1] + S[:-1]
    if S == T:
        print('Yes')
        break
    else:
        i += 1
if i == len(T):
    print('No')

Submission status: Accepted

Solution code:
import sys
S = input()
T = input()
for i in range(0,len(S)):
    if S[(len(S)-i):]+S[0:(len(S)-i)] == T:
        print("Yes")
        sys.exit()
if S == T:
    print("Yes")
    sys.exit()
else:
    print("No")
    sys.exit()

Submission status: Accepted

Solution code:
from sys import stdin
S=(stdin.readline().rstrip())
T=(stdin.readline().rstrip())
if S == T:
    print("Yes")

else:
    flag=0
    moji=S
    for s in reversed(S):
        moji=s+moji[:-1]
        if moji == T:
            print("Yes")
            flag=1
            break
    if flag==0:
        print("No")

Submission status: Accepted

Solution code:
import sys

s=input()
t=input()
N=len(s)

for i in range(N):
    j=0
    for j in range(N):
        if t[-i+j]!=s[j]: break
        elif j==N-1:
            print("Yes")
            sys.exit()
    
    if i==N-1:
        print("No")
        sys.exit()

Submission status: Accepted

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

ans = "No"
l = len(s)

for i in range(l):
    if s[-i - 1 : l] == t[0 : i + 1] and s[0 : -i - 1] == t[i + 1 : l]:
        ans = "Yes"
print(ans)

Submission status: Accepted

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

# print(s[-1])
# print(s[:-1])

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

Submission status: Accepted

Solution code:
s=input()
t=input()
q=0
for i in range(len(s)):
    if s==t:
        print("Yes")
        q=1
        break
    s=s[1:]+s[0]
if q==0:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = list(input())
c = 0
for a in range(len(s)):
    if s == t:
        c = 1
        break
    s.append(s[0])
    del s[0]
if c ==1:
    print("Yes")
    
else:
    print("No")

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
count = 0
for i in range(len(S)):
    if S == T:
        count += 1
    S.append(S[0])
    del S[0]
if count > 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#coding: utf-8
S = input()
T = input()
flag = False
for i in range(1, len(S)+1):
    S = S[-1] + S[:-1]
    if S == T:
        flag = True
        break
print("Yes" if flag else "No")

Submission status: Accepted

Solution code:

# -*- coding: utf-8 -*-

s = list(input())
t = list(input())

ans = False

for i in range(len(s)):
    if s == t:
        ans = True
        break
    temp = s[0]
    for j in range(1,len(s)):
        s[j-1] = s[j]
    s[-1] = temp

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

Submission status: Accepted

Solution code:
a=input()
b=input()
ans="No"
for i in range(len(a)):
  k=1
  for j in range(len(a)):
    j2=(j+i)%len(a)
    if a[j]!=b[j2]:
      k=0
      break
  if k==1:
    ans="Yes"
    break
    
print(ans)

Submission status: Accepted

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

ans = False
for i in range(1, len(S) + 1):
    S_ = S[-i:] + S[:len(S) - i]
    if S_ == T:
        ans = True

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

Submission status: Accepted

Solution code:
S, T = input(), input()
for i in range(len(S)):
    if T[i:] + T[:i] == S:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

Solution code:
s=list(input())
t=list(input())
ans="No"
for i in range(len(s)+1):
    if s[0:i:]==t[-i::] and s[i::]==t[0:len(s)-i:]:
        ans="Yes"
print(ans)

Submission status: Accepted

Solution code:
S=input()
T=input()
can=False
if S==T:
    can=True
for i in range(len(S)):
    S=S[1:]+S[0]
    if S==T:
        can=True
if can:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
t=input()*2
flag=False
for i in range(len(t)):
    if s==t[i:i+len(s)]:flag=True
if flag:print('Yes')
else:print('No')

Submission status: Accepted

Solution code:
s,t=input(),input()
for i in range(len(s)):
  if s==t:
    print("Yes")
    exit()
  s=s[1:]+s[0]
print("No")

Submission status: Accepted

Solution code:
def solve():
    s = input()
    t = input()
    for i in range(len(s)):
        if t == s[i:] + s[:i]:
            return True
        else:
            False
if solve():
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

for i in range(len(S)):
  if S == T:
    print('Yes')
    break
  else:
    S = S[-1] + S[0:-1]
    if i == len(S) - 1:
      print('No')
      break

Submission status: Accepted

Solution code:
def judge(s, t):
    for i in range(len(s)):
        tt = s[i:] + s[:i]
        if t == tt:
            return True
    return False

S = input()
T = input()

print("Yes" if judge(S, T) else "No")

Submission status: Accepted

Solution code:
s=str(input())
t=str(input())
a=True
for i in range(len(s)):
    if s==t:
        a=False
        break
    s=s[-1]+s[:-1]
if a:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

ans = False
for i in range(len(s)+1):
  if s == t:
    ans = True
    break
  s = s[1:] + s[0]
    
if ans:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#103
s = input()
t = input()
ans = False
for _ in range(len(s)):
    if(s==t):
        ans = True
        break
    else:
        s = s[-1]+s[:-1]
if ans:
    print("Yes")
else:
    print("No")