例如:输入abcba,输出1;否则,输出0
#include <stdio.h>
#include <string.h>
int isPlalindrome(char * s);
int main() {
char t[80];
char s[80];
int m;
int i = 0;
scanf("%s", s);
if( isPlalindrome(s) ) {
printf("1");
} else {
printf("0");
}
return 0;
}
int isPlalindrome(char * s) {
int i = 1;
int k = 0;
char * p = s;
char * q = s;
while( *(s++) != '\0' ) {
k++;
}
while( *p != '\0' ) {
if( *p != *(q+k-1) ) {
i = 0;
break;
}
p++;
k--;
}
return i;
}