KMP algorithm update1