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:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
s = list(input())
t = list(input())
le = len(s)
for i in range(le):
    if t == (s[le-i:]+s[:le-i]):
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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

Submission status: Accepted

Solution code:
S = list(input().strip())
T = list(input().strip())
flag = 0
for i in range(len(S)):
    S1 = S[i:]+S[:i]
    if S1==T:
        flag = 1
        break
if flag==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a

# Union Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# 約数生成
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


inf = 10 ** 18
mod = 10 ** 9 + 7

s = sr()
t = sr()
n = len(s)
flag = True
for i in range(n):
    flag = True
    for j in range(i,i+n):
        if s[j%n] != t[j-i]:
            flag = False
            break
    if flag:
        break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
import collections
s=input()
t=input()
s2=collections.deque([])
for i in s:
  s2.append(i)
for i in range(len(s)):
  if ''.join(s2)==t:
    print('Yes')
    sys.exit()
  c=s2.popleft()
  s2.append(c)
print('No')

Submission status: Accepted

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

print('No')

Submission status: Accepted

Solution code:
def check():
  S = input()
  T = input()
  S *= 2
  for i in range(len(T)):
    if S[i:i+len(T)]==T:
      return 'Yes'
  return 'No'
print(check())

Submission status: Accepted

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

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

Submission status: Accepted

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

flg = False
ok = False


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

Submission status: Accepted

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

Submission status: Accepted

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

a = list(s)
b = list(t)

answer = False

for i in range(len(a)):
    if a == b:
        answer = True
        break
    else:
        c = []
        p = a[len(a)-1]
        c.append(p)
        for j in range(len(a)-1):
            c.append(a[j])
        for h in range(len(a)):
            a[h] = c[h]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def rotate(l, n):
    return l[-n:] + l[:-n]

s = input()
t = input()

flg = False
for i in range(len(s)):
  flg = flg or rotate(s, i) == t

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
T = list(input())
flag = True
for _ in range(len(S)):
    last = S.pop()
    S.insert(0, last)
    if S == T:
        print('Yes')
        flag = False
        break
if flag:
    print('No')

Submission status: Accepted

Solution code:
# ABC103 B - String Rotation


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

Submission status: Accepted

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

ans = "No"

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

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    T = input()
    print("Yes" if T in S*2 else "No")
resolve()

Submission status: Accepted

Solution code:
# abc103_b.py
# https://atcoder.jp/contests/abc103/tasks/abc103_b

# B - String Rotation /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 英小文字からなる文字列 S, Tが与えられます。
# Sを回転させて Tに一致させられるか判定してください。
# すなわち、以下の操作を任意の回数繰り返して Sを Tに一致させられるか判定してください。

# 操作: S=S1S2...S|S|のとき、S を S|S|S1S2...S|S|−1に変更する
# ここで、|X|は文字列 Xの長さを表します。

# 制約
#     2≤|S|≤100
#     |S|=|T|S, Tは英小文字からなる

# 入力
# 入力は以下の形式で標準入力から与えられる。
# S
# T

# 出力
# Sを回転させて Tに一致させられる場合は Yes、一致させられない場合は No を出力せよ。

# 入力例 1
# kyoto
# tokyo

# 出力例 1
# Yes
#     1回目の操作で kyoto が okyot になります
#     2回目の操作で okyot が tokyo になります

# 入力例 2
# abc
# arc

# 出力例 2
# No

# 何度操作を行っても abc と arc を一致させられません。

# 入力例 3
# aaaaaaaaaaaaaaab
# aaaaaaaaaaaaaaab

# 出力例 3
# Yes


def calculation(lines):
    la = lines[0]
    lb = lines[1]
    flag = False
    for _ in range(len(la)):
        la = la[1:] + la[:1]
        if la == lb:
            return ['Yes']
    return ['No']


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['kyoto', 'tokyo']
        lines_export = ['Yes']
    if pattern == 2:
        lines_input = ['abc', 'arc']
        lines_export = ['No']
    if pattern == 3:
        lines_input = ['aaaaaaaaaaaaaaab', 'aaaaaaaaaaaaaaab']
        lines_export = ['Yes']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a=input()
b=input()
c=b
res="No"
for i in range(len(a)):
    c=c[-1]+c[:-1]
    if a==c:
        res=("Yes")
        break
print(res)

Submission status: Accepted

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

SS = S*2
print('Yes' if T in SS else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#61
s = input()
t = input()
l = len(s)

mozi = s*2
ans = "No"

for i in range(l):
    if mozi[i:i+l] == t:
        ans = "Yes"
        break

print(ans)

Submission status: Accepted

Solution code:
S = input()
T = input()
for i in range(len(S)):
  S = S + S[0]
  S = 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:
if __name__ == '__main__':
	
	s = input()
	t = input()

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

Submission status: Accepted

Solution code:
s = input()
t = input()
flg = any(s[-i:] + s[: len(s) - i] == t for i in range(1, len(s) + 1))
print(["No", "Yes"][flg])

Submission status: Accepted

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

rotates = []
for i in range(len(s)):
  s = s[-1]+s[:len(s)-1]
  rotates.append(s)

if t in rotates:
  print("Yes")
else :
  print("No")

Submission status: Accepted

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

def irekae(s):
  List = list(s)
  a = List.pop(0)
  List.append(a)
  res = ""
  for i in range(len(s)):
    res += List[i]
  return res

if S == T:
  flag = True
else:
  for i in range(len(S)):
    S = irekae(S)
    if S == T:
      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 T == (S[(i+1):len(S)] + S[0:(i+1)]):
    print('Yes')
    break
else:
  print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

rolled = S

ans = "No"

for _ in S:
    rolled = rolled[-1] + rolled[:-1]
    if rolled == T:
        ans = "Yes"
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

s, t = read().decode().rstrip().split()
ans = 'No'
for i in range(len(s)):
    s = s[-1]+s[:-1]
    if s == t:
        ans = 'Yes'
        continue
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = False
for _ in range(len(s)):
    l = list(s)
    c = l.pop(-1)
    l.insert(0, c)
    s = ''.join(l)
    
    # print(s)
    if s == t:
        ans = True
        break
    
if ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def f(s,t): return t in (s + s)
print 'Yes' if f(raw_input(),raw_input()) else 'No'

Submission status: Accepted

Solution code:
s,t = open(0).read().split()

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

Submission status: Accepted

Solution code:
def main():
    a=input()
    b=input()
    for _ in range(len(a)+1):
        if a == b:
            print("Yes")
            break
        a = a[-1] + a[:-1]
    else:
        print("No")
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(N):
    ref = ""
    ref = S[i:N] + S[0:i]
    if ref == T:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
T = input()
pos = False
i = -1
while True:
    try:
        i = T.index(S[0], i+1)
        if T[i:] + T[:i] == S:
            print("Yes")
            break
    except:
        print("No")
        break

Submission status: Accepted

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np 
s=input()
t=input()
for i in range(len(s)):
    s=s[-1]+s[:-1]
    if s==t:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

for _ in range(len(S)):
    S_lst = list(S)
    tmp = S[0]
    for i in range(len(S) - 1):
        S_lst[i] = S_lst[i+1]
    S_lst[-1] = tmp
    S = ''.join(S_lst)
    
    if S == T:
        print("Yes")
        exit()
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
t = input()
for i in range(len(s)):
    rotate_s = s.pop()
    s.insert(0, rotate_s)
    if "".join(s) == t:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
if len(S)==1:
    Flag = (S==T)
else:
    Flag = False
    for X in range(0,len(S)):
        S = S[-1]+S[0:-1]
        if S==T:
            Flag = True
            break
if Flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

S = s * 2
if t in S:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

n = 0
m = len(s)
while n != m:
  if s == t:
    print("Yes")
    exit()
  s = s[-1]+s[:m-1]
  n += 1
print("No")

Submission status: Accepted

Solution code:
s = str(input())
t = str(input())
n = len(s)
x = s
ans = 'No'
for _ in range(n):
    if x == t:
        ans = 'Yes'
        break
    nx = x[-1] + x[:n-1]
    x = nx
print(ans)

Submission status: Accepted

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

for i in range(len(S)):
    flg = True
    for j in range(i, len(S)):
        if S[j] != T[j - i]:
            flg = False
            break
    if not flg:
        continue
    for j in range(i):
        if S[j] != T[j + len(S) - i]:
            flg = False
            break
    if flg:
        print('Yes')
        sys.exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

T = T+T

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
t = S()
ans = 'No'
for _ in range(101):
    if s == t:
        ans = 'Yes'
        break
    else:
        t = t[1:] + t[0]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = input()
t = input()
for i in range(len(s)):
    if s[i + 1:] + s[:i + 1] == t:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
 
S = input().rstrip('\n')
T = input().rstrip('\n')

result = 'No'

for i in range(len(S)):
  if S[-i:]+S[:-i] == T:
    result ='Yes'

      
print(result)

Submission status: Accepted

Solution code:
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

S = list(input().rstrip('\n'))
T = list(input().rstrip('\n'))

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a = s()
b = s()

sample = ""
for i in range(len(a)):
	a = a[-1] + a[0:-1]
	if a == b:
		print("Yes")
		exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

sys.exit() if not (S.islower() or T.islower()) else ''
sys.exit() if not (2 <= len(S) <= 100) else ''

array_S = list(S)
array_T = list(T)

for I in range(len(array_S)):
    array_S.insert(0,array_S.pop(-1))
    if array_S == array_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(0)
    a = s[-1]
    s.pop(-1)
    s[0:0] = a

print('No')

Submission status: Accepted

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

L = len(S)

ok = False

for i in range(L):
    if T == S[i:L] + S[0:i]:
        ok = True

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

Submission status: Accepted

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

s_len = len(s)

is_yes = False

rotate_s = s
for i in range(s_len):
	if(rotate_s == t):
		is_yes = True
		break
	rotate_s = rotate_s[-1] + rotate_s[:s_len - 1]
if(is_yes):
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
from collections import deque
s = deque(list(input()))
t = deque(list(input()))

for i in range(len(s)+1):
  if s == t:
    print("Yes")
    exit()
  p = s.pop()
  s.appendleft(p)
print("No")

Submission status: Accepted

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

N=len(S)
F=False
for _ in range(N):
    S=S[-1]+S[:-1]
    F|=(S==T)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

t = list(input())

f = 0

for i in range(len(s)):
    s.append(s[0])
    del s[0]
    if s == t:
        f = 1
        
if f == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
i = 0
while True:
    S = S[-1:]+S[:-1]
    if S == T:
        print("Yes")
        break
    else:
        i += 1
    if i == len(S):
        print("No")
        break

Submission status: Accepted

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

Submission status: Accepted

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

for _ in range(len(S)):
    S = S[-1] + S[:-1]
    if T == S:
        print("Yes")
        exit(0)

else:
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

S = input()
T = input()

cnt = 0
while cnt < len(S):
    S = S[-1] + S[:-1]
    cnt += 1
    if S == T:
        print('Yes')
        exit()


print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
import sys

deque_s = deque(list(input()))
deque_t = deque(list(input()))

for _i in range(len(deque_s)):
    deque_s.rotate()
    if deque_s == deque_t:
        print('Yes')
        sys.exit()

print('No')

Submission status: Accepted

Solution code:
from collections import deque

s = deque(list(input()))
t = deque(list(input()))
ans = "No"

for i in range(len(s)):
    if s == t:
        ans = "Yes"
        break
    t.rotate()

print(ans)

Submission status: Accepted

Solution code:
def ans(s,t):
    for i in range(len(s)):
        s = s[-1] + s[:-1]

        if s == t:
            return "Yes"
    return "No"

s = input()
t = input()

ans = ans(s,t)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
T = input()
a = "No"

for n in range(len(S)):
  if S[n:]+S[:n]==T:
    a = "Yes"

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - String Rotation
from collections import deque

S = deque(str(input()))
T = deque(str(input()))
N = len(S)
ans = 'No'

for _ in range(N):
    S.append(S.popleft())
    if S == T:
        ans = 'Yes'

print(ans)

Submission status: Accepted

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

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

for i in range(len(s)):
    p=s.pop(0)
    s.append(p)
    if s==t:
        print("Yes")
        exit()
        
print("No")

Submission status: Accepted

Solution code:
import sys

s = input()
t = input()

for i in range(len(s)):
    f = 1
    for j in range(len(s)):
        if s[j] != t[j-i]:
            f = 0
    if f == 1:
        print('Yes')
        sys.exit()

    
print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    from collections import deque
    S = deque(input())
    T = deque(input())
    for i in range(len(S)):
        S.rotate(1)
        if list(S) == list(T):
            print("Yes")
            return
    print("No")


resolve()

Submission status: Accepted

Solution code:
def actual(s, t):
    """
    kyoto
    okyot
    tokyo
    otoky
    yotok
    kyoto
    """
    for _ in range(len(s)):
        s = s[-1] + s[:-1]

        if s == t:
            return 'Yes'

    return 'No'

s = input()
t = input()

print(actual(s, t))

Submission status: Accepted

Solution code:
from collections import deque
s = list(input())
t = list(input())

sd = deque(s)
n = len(s)
for i in range(n):
    if list(sd) == t:
        print('Yes')
        exit()
    sd.appendleft(sd.pop())

print('No')

Submission status: Accepted

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

Submission status: Accepted

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


def rolling(str, n):
    return str[n:len(str)] + str[:n]


for i in range(len(S)):
    if S == rolling(T, i):
        print("Yes")
        exit()

print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def rolling(str, n):
    return str[n:len(str)] + str[:n]


S = input()
T = input()
for i in range(len(S)):
    if rolling(S, i) == T:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

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


s = s*2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

S = input()
T = input()

for dif in range(len(S)):
    ok = True
    for i, t in zip(range(dif, dif+len(S)), T):
        ri = i%len(S)
        if S[ri] != t:
            ok = False
        if not(ok):
            break
    else:
        if ok:
            print('Yes')
            exit()
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()


def main():
    S = deque(input())
    T = deque(input())
    same = False
    for _ in range(len(S)):
        if S == T:
            same = True
            break
        c = S.popleft()
        S.append(c)
    if same: print("Yes")
    else: print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print("No")