update function isPalindrome() in Ex1