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