import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); String line=sc.nextLine(); String s; int max=0; for(int i=0;i<line.length();i++){ for(int j=line.length();j>i;j--){ s=line.substring(i,j); if(line.length()-i<max) break; if(check(s)&&s.length()>max) max=s.length(); } } System.out.println(max); } public static boolean check(String s){ return s.equals(new StringBuilder(s).reverse().toString()); } }