// 100_46.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int find_len(char * str)
{
if(str==NULL)
return 0;
int len = 1;
char * cur = str;
while(*str!='\0')
{
char * left = cur-1;
char * right = cur+1;
while(left>=str && *right!='\0' && *left==*right)
{
left--;
right++;
}
int new_len = right-left+1;
if(new_len > len)
len = new_len;
left = cur-1;
right = cur+1;
while(left>=str && *right!='\0' && *left==*right)
{
left--;
right++;
}
new_len = right-left+1;
if(new_len > len)
len = new_len;
str++;
}
return len;
}
int _tmain(int argc, _TCHAR* argv[])
{
char str[] = "google";
printf("%d\n",find_len(str));
return 0;
}