longest palindromic string using O(n) time and O(1) space. TODO: this problm using DP