赞
踩
#include<string.h>
int longestPalindrome(char * s){
char*s1=s;
int len =strlen(s);
int count=0;
char tepm;
for(int i=0;i<len;i++){
if(*(s1+i)==0)continue;
tepm=*(s1+i);
for(int j=i+1;j<len;j++){
if(tepm==*(s1+j)&&*(s1+j)!=0){
count+=2;
s1[j]=0;
break;
}
}
}
if(count!=len){
count++;
}
return count;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。