third version for palindrome algorithm