#include<stdio.h>
#include<string.h>
int main()
{
char arr[2500]="";
scanf("%s",arr);
int len = strlen(arr);
int max=0;
for(int i=0;i<len;i++)
{
int count = 0;
int k=1;
while( k+i<len && (i-k)>=0 )
{
if(arr[i+k]==arr[i-k])
{
count+=2;
if(count>max)
max=count+1;
}
else
break;
k++;
}
}
for(int i=0;i<len-1;i++)
{
int count=0;
if(arr[i]==arr[i+1])
{
int k=0;
while( i+k+1<len && (i-k)>=0 )
{
if(arr[i+k+1]==arr[i-k])
{
count+=2;
if(count>max)
max=count;
}
else
break;
k++;
}
}
}
printf("%d",max);
return 0;
}
#include<string.h>
int main()
{
char arr[2500]="";
scanf("%s",arr);
int len = strlen(arr);
int max=0;
for(int i=0;i<len;i++)
{
int count = 0;
int k=1;
while( k+i<len && (i-k)>=0 )
{
if(arr[i+k]==arr[i-k])
{
count+=2;
if(count>max)
max=count+1;
}
else
break;
k++;
}
}
for(int i=0;i<len-1;i++)
{
int count=0;
if(arr[i]==arr[i+1])
{
int k=0;
while( i+k+1<len && (i-k)>=0 )
{
if(arr[i+k+1]==arr[i-k])
{
count+=2;
if(count>max)
max=count;
}
else
break;
k++;
}
}
}
printf("%d",max);
return 0;
}