Solution to Longest Palindromic Substring