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