<qiyuangong>028_Implement_strStr()_3.py
def makeNext( needle):
    ls = len(needle)
    next = [0] * ls
    next[0], i, j = -1, 0, -1
    while i < ls - 1:
        if j == -1 or needle[i] == needle[j]:
            next[i + 1] = j + 1
            if needle[i + 1] == needle[j + 1]:
                next[i + 1] = next[j + 1]
            i += 1
            j += 1
        if needle[i] != needle[j]:
            j = next[j]
    return next
def sample_funcname ( var_0 ) :
    var_2 = len ( var_0 )
    var_4 = [ 0 ] * var_2
    var_4 [ 0 ] , var_6 , var_7 = - 1 , 0 , - 1
    while var_6 < var_2 - 1 :
        if var_7 == - 1 or var_0 [ var_6 ] == var_0 [ var_7 ] :
            var_4 [ var_6 + 1 ] = var_7 + 1
            if var_0 [ var_6 + 1 ] == var_0 [ var_7 + 1 ] :
                var_4 [ var_6 + 1 ] = var_4 [ var_7 + 1 ]
            var_6 += 1
            var_7 += 1
        if var_0 [ var_6 ] != var_0 [ var_7 ] :
            var_7 = var_4 [ var_7 ]
    return var_4
