Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
You do not need to consider substrings having lengths greater than 30.
Pre-process all substrings with lengths not greater than 30, and add the best endpoints to a dictionary.