Find the longest Consecutive Substring (Increasing Alphabetically) from the below pattern that starts with A.
[?, B, A, ?, C, D, ?, ?, F, I, ?, ?, ?, ?, D, ?, ?, ?, H]
You can assume ? as any character. it can be repace by 0 or 1 character.
Note: Consider all as upper case.
Exp: One of the Substrings is A, B, C, D, E, F from index 2 to 7.
But the longest substring can be formed from index 11 to 18 which A,B,C,D,E,F,G,H.
How to solve this with optimized way?.