I am trying to understand why the KMP algorithm does not cater for a special case in which all of the characters of the pattern we are trying to find are known to be the same.
For example. Suppose we are searching for the pattern AAAAA in the string XXAAAAFXXXXX.
The search will fail when the last letter of the pattern is compared with F in the string
If we know in advance that all of the letters in the pattern as the same, then surely we can jump ahead 5 letters and start checking again from here, like this.
However, all of the variations of KMP that I have come across jump ahead by only one place, like this (although the previously matched characters are not checked again).
I believe it would be simple enough to implement a variation of KMP that catered for a scenario in which all of the characters of the pattern were the same as each other. So why is this not the case, am I missing something?