"A book to train programming skills to fight in the world" Python code answer example --1.9 Rotation of strings
def isSubstring(s1,s2):
return s2 in s1
def isRotation(s1,s2):
length = len(s1)
if length==len(s2) and length>0:
s1s1 = s1 + s1
return isSubstring(s1s1,s2)
return False
input_str_1 = "waterbottle"
input_str_2 = "bottlewater"
print(isRotation(input_str_1,input_str_2))
input_str_3 = "waterbottle"
input_str_4 = "water"
print(isRotation(input_str_3,input_str_4))