alternative solution to isPalindrome, no extra copy of input