longest sub palindrome using dynamic programming O(n^2)