Can you tell me the idea behind the Knuth-Morris-Pratt string matching algorithm?