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

Submission attempts (in order):
import numpy as np

S_line = input()
T_line = input()

length = len(S_line)

index_list = []
def index_maker(start_n, length):
    for loc in range(length):
        if loc > start_n:
            index_list.append(loc)
        
    for loc in range(start_n + 1):
        #print(str(start_n) +":"+ str(loc))
        index_list.append(loc)
    if start_n + 1 == length:
        return range(length)

    return(index_list)

ac_flag = 0
index_list = []
y_flag = 0

for i in range(length):
    index_list = index_maker(i, length)
    for i, index in enumerate(index_list):
        if T_line[i] != S_line[index]:
            ac_flag += 1
    if ac_flag == 0:
        y_flag += 1
    ac_flag = 0
    index_list = []

if y_flag != 0:
    print("yes")
else:
    print("No")



import numpy as np

S_line = input()
T_line = input()

length = len(S_line)

index_list = []
def index_maker(start_n, length):
    for loc in range(length):
        if loc > start_n:
            index_list.append(loc)
        
    for loc in range(start_n + 1):
        #print(str(start_n) +":"+ str(loc))
        index_list.append(loc)
    if start_n + 1 == length:
        return list(range(length))

    return(index_list)

ac_flag = 0
index_list = []
y_flag = 0

for i in range(length):
    index_list = index_maker(length-1 - i, length)
    #print(index_list)
    for i, index in enumerate(index_list):
        #print("i: " + str(i) +" index: "+ str(index))
        if T_line[i] != S_line[index]:
            ac_flag += 1
    if ac_flag == 0:
        y_flag += 1
    ac_flag = 0
    index_list = []

if y_flag != 0:
    print("yes")
else:
    print("No")



import numpy as np

S_line = input()
T_line = input()

length = len(S_line)

index_list = []
def index_maker(start_n, length):
    for loc in range(length):
        if loc > start_n:
            index_list.append(loc)
        
    for loc in range(start_n + 1):
        #print(str(start_n) +":"+ str(loc))
        index_list.append(loc)
    if start_n + 1 == length:
        return list(range(length))

    return(index_list)

ac_flag = 0
index_list = []
y_flag = 0

for i in range(length):
    index_list = index_maker(i, length)
    #print(index_list)
    for i, index in enumerate(index_list):
        #print("i: " + str(i) +" index: "+ str(index))
        if T_line[index] != S_line[i]:
            ac_flag += 1
    if ac_flag == 0:
        y_flag += 1
    ac_flag = 0
    index_list = []

if y_flag != 0:
    print("yes")
else:
    print("No")



import numpy as np

S_line = input()
T_line = input()

length = len(S_line)

index_list = []
def index_maker(start_n, length):
    for loc in range(length):
        if loc > start_n:
            index_list.append(loc)
        
    for loc in range(start_n + 1):
        #print(str(start_n) +":"+ str(loc))
        index_list.append(loc)
    if start_n + 1 == length:
        return list(range(length))

    return(index_list)

ac_flag = 0
index_list = []
y_flag = 0

for i in range(length):
    index_list = index_maker(length-1 - i, length)
    #print(index_list)
    for i, index in enumerate(index_list):
        #print("i: " + str(i) +" index: "+ str(index))
        if T_line[i] != S_line[index]:
            ac_flag += 1
    if ac_flag == 0:
        y_flag += 1
    ac_flag = 0
    index_list = []

if y_flag != 0:
    print("Yes")
else:
    print("No")



Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted