Sponsored
Use these hints if you're stuck. Try solving on your own first.
Preprocess checking palindromes in O(1)
Note that one string is a prefix and another one is a suffix you can try brute forcing the rest
Solve with full IDE support and test cases