Length of the Longest Valid Substring
Slide a window to the right and move its left edge past every forbidden string that ends at the current letter.
Slide a window to the right and move its left edge past every forbidden string that ends at the current letter.