solve valid palindrome