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