modify blog kmp-algorithm