Knuth-Morris-Pratt code