28.Implement strStr()

class Solution:
    def strStr(self, haystack: str, needle: str) -> int:
        if len(needle) == 0:
            return 0
        else:
            for i in range(len(haystack)):
                if haystack[i: i+len(needle)] == needle :
                    return i
            return -1
原文地址:https://www.cnblogs.com/luo-c/p/12857182.html