def maximum_border_length(w):
    """Maximum string borders by Knuth-Morris-Pratt

    :param w: string
    :returns: table l such that l[i] is the longest border length of w[:i + 1]
    :complexity: linear
    """
    n = len(w)
    L = [0] * n
    k = 0
    for i in range(1, n):
        while w[k] != w[i] and k > 0:
            k = L[k - 1]
        if w[k] == w[i]:
            k += 1
            L[i] = k
        else:
            L[i] = 0
    return L
