#include<bits/stdc++.h>
using namespace std;
 
  
int main()
{
    string text;
    cin>>text;
    int n = text.size();
    int firstI = 0;
    int lastI = 0;
    for(int i=0 ; i<n/2; i++)
    {
 
        if(text[i] == text[n-1-i])
        {
             continue;
        }
           
 

        if(firstI==0)
        {
            firstI = i;
        }  
        else
        {
            lastI = i;
        }
       
    }

    cout<<lastI-firstI+1<<endl;
return 0;
}