KMP counting number of occurences of a pattern in text