solved palindrome method