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