bool judge(char c){
if(c>='a'&& c<='z' || c>='A' && c<='Z' || c>='0' && c<='9' ) return true;
return false;
}
bool isPalindrome(char* s) {
int n=strlen(s);
char* array=(char*)malloc(sizeof(char)*(n+1));
int head=0,index=0;
while(index<n){
if(judge(s[index])){
if(s[index]>='A' && s[index] <= 'Z') s[index]=s[index]-'A'+'a';
array[head++]=s[index++];
}else{
index++;
}
}
for(int i=0;i<head;i++) printf("%c",array[i]);
if(head==0) return true;
int tail=head-1;
head=0;
while(head<=tail){
if(array[head]!=array[tail]) return false;
head++;
tail--;
}
return true;
}
标签:index,验证,char,125,&&,回文 From: https://www.cnblogs.com/llllmz/p/18088212