Sponsored
Use these hints if you're stuck. Try solving on your own first.
Generate all possible substrings & check for each substring if it's valid and keep updating maxLen accordingly.
Solve with full IDE support and test cases