#include "palindrome.h" #include int palindrome(const char *s) { if (s == NULL) { return 0; } if (*s == '\0') { return 1; } const char *p = s; while (*p) { p++; } p--; while (p > s) { while ((*p < '0' || (*p > '9' && *p < 'A') || (*p > 'Z' && *p < 'a') || *p > 'z') && p > s) { p--; } while ((*s < '0' || (*s > '9' && *s < 'A') || (*s > 'Z' && *s < 'a') || *s > 'z') && p > s) { s++; } if (*p != *s) { return 0; } p--; s++; } return 1; }