Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use brute force approach with two loops.
Optimize using prefix and suffix arrays.
Solve with full IDE support and test cases