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