Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Fix the <code>left</code> index of the substring.
For the fixed <code>left</code> index, find the first <code>right</code> index for which substring <code>s[left..right]</code> satisfies the condition.
Every substring that starts at <code>left</code> and ends after <code>right</code> satisfies the condition.