import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; public class Main { public static long MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); final char[] input = sc.next().toCharArray(); int answer = 0; for(int start = 0; start < input.length; start++){ // for_odd int odd_count = 1; for(int diff = 1; diff <= input.length; diff++){ final int left = start - diff; final int right = start + diff; if(left < 0 || right >= input.length){ break; } if(input[left] == input[right]){ odd_count += 2; } } int even_count = 0; for(int diff = 1; diff <= input.length; diff++){ final int left = start - (diff - 1); final int right = start + diff; if(left == 0 || right >= input.length){ break; } if(input[left] == input[right]){ even_count += 2; } } answer = Math.max(answer, Math.max(odd_count, even_count)); } System.out.println(answer); } }