import java.util.*;
public class Main {
public static void main(String[] arg) {
Scanner s = new Scanner(System.in);
while (s.hasNext()) {
String input = s.nextLine();
StringBuilder sb = new StringBuilder(input);
StringBuilder sbReverse = new StringBuilder(sb.reverse());
int count = 0;
int tempCount = 0;
for (int i = 0; i < input.length(); i++) {
if (input.charAt(i) != sbReverse.charAt(i)) {
tempCount = 0;
} else {
tempCount = tempCount + 1;
count = Math.max(count, tempCount);
}
}
System.out.println(count);
}
}
}