import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] arr = sc.next().toCharArray(); int max = 0; for (int i = 0; i < arr.length; i++) { int left1 = i; int right1 = i; while (left1 >= 0 && right1 < arr.length && arr[left1] == arr[right1] && !(left1 == 0 && right1 == arr.length - 1)) { max = Math.max(right1 - left1 + 1, max); left1--; right1++; } left1 = i; right1 = i + 1; while (left1 >= 0 && right1 < arr.length && arr[left1] == arr[right1] && !(left1 == 0 && right1 == arr.length - 1)) { max = Math.max(right1 - left1 + 1, max); left1--; right1++; } } System.out.println(max); } }