left and right. Cut a substring (a contiguous piece, possibly empty) out of left and a substring (also possibly empty) out of right, then append the second piece to the end of the first.
Return the greatest length of a palindrome you can build this way. A palindrome reads the same left to right and right to left.left="cart", right="track" → 8
The piece "cart" from left and the piece "rac" from right make "cartrac", a palindrome of length 7.
left="xyz", right="pqr" → 1
The strings share no letters, so the best is a single letter, length 1.
left="q", right="abba" → 4
You may take nothing from left: "abba" from right is a palindrome of length 4.
left="cart", right="track"
8
Run checks the first 3 tests in your browser. Submit checks all 103 tests on the server, hidden ones included.