get the longest palindrome using Dynamic Programming