DP longest sub string prefix, palidrome