adding palindrome solution from chapter 5