import java.util.Scanner;
import java.io.*;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String str = "";
while ((str=reader.readLine())!=null){
int max = str.length();
boolean A = false;
while (max>0){
int left = 0;
int right = max-left-1;
while (right<str.length()){
if (hui(str, left, right)) {
System.out.println(max);
A = true;
break;
}
left++;
right++;
}
if (A) break;
max--;
}
}
}
public static boolean hui(String S, int left, int right) {
while (left<right){
if (S.charAt(left)!=S.charAt(right)) return false;
left++;
right--;
}
return true;
}
}