import java.io.*; import java.util.*; class Main { public static void out (Object o) { System.out.println(o); } public static boolean isReversible (String s) { int len = s.length(); for (int i = 0; i < len / 2; i++) { if (s.charAt(i) != s.charAt(len - i - 1)) return false; } return true; } public static int solve (String s) { int len = s.length(); for (int i = len; i > 0; i--) { for (int j = 0; i + j <= len; j++) { String sub = s.substring(j , i + j); //out(sub); if (isReversible(sub)) return i; } } return 0; } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); out(solve(br.readLine())); } }