class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if needle =="":
return 0
if len(haystack) == len(needle):
if haystack == needle:
return 0
else:
return -1
haystack = list(haystack)
needle = list(needle)
if len(haystack) <len(needle):
return -1
len2=len(needle)
for i in range(len(haystack)):
p=0
if needle[0] ==haystack[i]:
h=i
j=0
while (j<len2) and (i<len(haystack)) and (needle[j]==haystack[i]) and (p<len2) :
print(i)
print(j)
i=i+1
j=j+1
p=p+1
if p == len2:
return h
return -1