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 = 1; for (int i = 0; i < arr.length; i++) { int count1 = 1; for (int j = 1; i - j >= 0 && i + j < arr.length; j++) { if (arr[i - j] == arr[i + j]) { count1 += 2; } } max = Math.max(max, count1); int count2 = 0; for (int j = 0; i - j >= 0 && i + j + 1 < arr.length; j++) { if (arr[i - j] == arr[i + j + 1]) { count2 += 2; } } max = Math.max(max, count2); } System.out.println(max); } }