Knuth-Morris-Pratt implementation
Test for KMP