import java.util.*; import java.io.*; import java.math.*; import java.util.stream.Stream; public class Main{ /* 入出力 */ static BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter output = new PrintWriter(System.out); static Scanner sc = new Scanner(System.in); /* 定数 */ static final int [] y4 = {0,1,0,-1}; static final int [] x4 = {1,0,-1,0}; static final int INF1 = Integer.MAX_VALUE; static final long INF2 = Long.MAX_VALUE; static final long MOD1 = (long)1e9+7; static final long MOD2 = 998244353; /* Main */ public static void main(String[] args) throws IOException{ /* * 決め打ち二分探索 */ String S = sc.next(); StringBuilder r = new StringBuilder(); r.append(S); String revers = r.reverse().toString(); int min = S.length(); int left = 1; int right = min; int ans = INF1; while(left <= right) { int x = (left + right)/2; if(check(S,x)) right = x-1; else left = x+1; } if(right == S.length()) { if(S.equals(revers)) { output.print(right); } else{ output.print(1); } } else{ output.print(right); } output.flush(); } static boolean check(String s,int mid) { boolean flag = false; int len = 0; int min = INF1; StringBuilder sb = new StringBuilder(); for(int i=0;i= 2) { String bas = sb.toString(); String rev = sb.reverse().toString(); if(bas.equals(rev)) { len += bas.length(); min = Math.min(bas.length(),min); sb.delete(0,sb.length()); } } } return min < mid; } }