Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
int fun(char *p) {
int i=0, j=0;
j = strlen(p) - 1;
while(p[i]==p[j] && i<=j) {
i++;
j--;
}
if(i>j) {
return 1;//此时为回文序列
} else {
return 0;//此时不为回文序列
}
}