Computing the KMP failure function (f(k))