import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String S = scan.next(); scan.close(); if(S.length() == 2) { System.out.println(1); System.exit(0); } int N = S.length(); for(int i = N - 1; i >= 2; i--) { for(int j = 0; j <= N - i; j++) { String s = S.substring(j, j + i); //System.out.println(s); boolean flag = true; for(int k = 0; k < s.length() / 2; k++) { char c1 = s.charAt(k); char c2 = s.charAt(s.length() - k - 1); if(c1 != c2) { flag = false; break; } } if(flag) { System.out.println(s.length()); System.exit(0); } } } System.out.println(1); } }