#include "stdafx.h"
#include "stdio.h"
#include "string.h"
int get_maxlen(char *str){
char * current=str;
int max_len=1;
int temp_len=1;
while(*current){
//奇数长度对称字符串处理
char * begin=current-1;
char * end=current+1;
while(begin>=str && *end && *begin==*end){
begin--;
end++;
}
temp_len=end-begin-1;
if(temp_len>max_len)
max_len=temp_len;
//偶数长度对称字符串处理
begin=current;
end=current+1;
while(begin>=str && *end && *begin==*end){
begin--;
end++;
}
temp_len=end-begin-1;
if(temp_len>max_len)
max_len=temp_len;
current++;
}
return max_len;
}
void main(){
char * str="woshioihsow";
printf("%d/n",get_maxlen(str));
}