checks if a string is palindrome