Suppose I have a string that goes like "abcabcdeaabcdef", where each character is either one more than the previous one or a.
If the character at position i is "c", I know that it is preceded by "ab".
I want to find the number and length of all sequences (substrings that contain sequential characters). For example, the above string would give "abc", "abcde", "a", "abcdef".
Is there a more efficient algorithm to do this than simply doing a O(n) search over the string?