change kmp algorithm.