import java.util.Scanner;
public class InterceptPassword {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String str=sc.nextLine();
sc.close();
char[] ch=str.toCharArray();
System.out.println(subPWD(ch));
}
public static int subPWD(char[] ch)
{
int max=1;
int ind=0;
char[] ch2=new char[ch.length];
for(int i=ch.length-1;i>=0;i--)
{
ch2[ind++]=ch[i];
}
for(int m=0;m<ch.length;m++)
{
for(int n=0;n<ch.length;n++)
{
if(ch[m]==ch2[n])
{
int count=1;
int l=m;
int k=n;
while(l<ch.length-1&&k<ch.length-1)
{
if(ch[++l]==ch2[++k])
{
count++;
}
else
{
break;
}
}
if(count>max)
{
max=count;
}
}
}
}
return max;
}
}