import java.io.*; public class Main{ public static void main(String[] args)throws IOException{

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  

// Scanner in = new Scanner(System.in); String str = in.readLine(); char[] c = str.toCharArray(); int len = str.length(); int max = 1; for(int i = 0;i < len; i++){ int len1 = findLongest(c,i,i); int len2 = findLongest(c,i,i+1);

        max = Math.max(max,Math.max(len1,len2));
    }
   System.out.println(max);
   
}
public static int findLongest(char[] str,int left,int right){
     int len = str.length;
    int max = 1;
    while(left >=0 && right < len && str[left] == str[right]){
     
            max = Math.max(max,right - left +1);
            left -- ;
            right ++;
            
        
    }
    return max;

}

}