import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
String str = sc.nextLine();
int max = 0;
for(int i = 0 ;i < str.length(); i++){
for(int j = i + 1; j <= str.length(); j++){
if(str.substring(i,j).equals(new StringBuilder(str.substring(i,j)).reverse().toString())){
if(j - i > max){
max = j - i;
}
}
}
}
System.out.println(max);
}
}
}