add solution without using extra space to find longest palindrome