Knuth–Morris–Pratt algorithm for occurrences of a "word" in string