check palindrome for a string iteratively and recursively