#include<iostream>
#define ll long long

using namespace std;

void FICA()
{
  string niska;

  cin>>niska;

  int duzina = niska.length();
  int i,j;

  for(i = 0, j = duzina - 1; i < j; ++i, --j){
     if(niska[i] != niska[j]){
        cout<<j - i<<endl;
        return;
     }
  }

    if(niska[i] == niska[j]){
        cout<<"1"<<endl;
        return;
    }

}

int main(void)
{
    FICA();
    return 0;
}