Completed printPalindrome