Checks if a string is a palindrome.