def maximum_border_length(w):
    n = len(w)
    L = [0] * (n + 1)
    for i in range(1, n):
        k = L[i]
        while w[k] != w[i] and k > 0:
            k = L[k]
        if w[k] == w[i]:
            L[i + 1] = k + 1
        else:
            L[i + 1] = 0
    return L
# snip}


# snip{ powerstring_by_border
creates bounding boxes for the selected objects
dataset/ETHPy150Open jilljenn/tryalgo/tryalgo/knuth_morris_pratt_border.py/maximum_border_length--crossover with--dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/create_bbox