import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        for(int i = 0; i < line.length() / 2;i++)
        {
            char c1 = line.charAt(i);
            char c2 = line.charAt(line.length()-1-i);
            if(c1 != c2)
            {
                System.out.println((line.length()-1-i) - i);
                return;
            }
        }
        System.out.println(1);
    }

}