You can find the the longest palindrome using Manacher’s Algorithm in O(n)
time! Its implementation can be found here and here.
For input String s = "HYTBCABADEFGHABCDEDCBAGHTFYW1234567887654321ZWETYGDE"
it finds the correct output which is 1234567887654321
.