text. Find its longest contiguous piece that reads the same forwards and backwards, and return that piece.
Uppercase and lowercase letters count as different characters. The input is guaranteed to have exactly one longest such piece.text="xlevelx9" → 'xlevelx'
The longest palindromic piece is xlevelx, seven characters long.
text="noonday" → 'noon'
noon reads the same both ways, and there is no longer palindrome.
text="Abba7" → 'bb'
Case matters: A and a are different characters, so Abba is not a palindrome. That leaves bb.
text) ≤ 1000text consists of digits and English letterstext="xlevelx9"
'xlevelx'
Run checks the first 3 tests in your browser. Submit checks all 103 tests on the server, hidden ones included.