P06 solution (isPalindrome)