#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
bool isPalindrome(const char *str);
int main() {
char input[100];
cout << "Enter a string: ";
cin.getline(input, 100);
if (isPalindrome(input))
cout << "The entered string is a palindrome." << endl;
else
cout << "The entered string is not a palindrome." << endl;
return 0;
}
bool isPalindrome(const char *str) {
int length = strlen(str);
int i = 0, j = length - 1;
while (i < j) {
while (i < j && !isalnum(str[i])) // Skip non-alphanumeric characters from the beginning
i++;
while (i < j && !isalnum(str[j])) // Skip non-alphanumeric characters from the end
j--;
if (tolower(str[i]) != tolower(str[j])) // Compare characters (case-insensitive)
return false;
i++;
j--;
}
return true;
}