import java.util.*; public class Exercise85{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); String s = sc.next(); char[] sArray = s.toCharArray(); int answer = 0; for(int i = 0; i < sArray.length; i++){ for(int j = sArray.length - 1; j >= i; j--){ if(sArray[i] == sArray[j]){ char[] kArray = Arrays.copyOfRange(sArray, i, j + 1); if(kArray.length == sArray.length){ continue; } char[] kArrayD = new char[kArray.length]; for(int k = 0; k < kArray.length; k++){ kArrayD[k] = kArray[kArray.length - 1 - k]; } System.out.println(Arrays.toString(kArray)); if(Arrays.equals(kArray, kArrayD)){ answer = Math.max(answer, kArray.length); } } } } System.out.println(answer); } }