#include <bits/stdc++.h>

using namespace std;

const int MAX = 2 * 100000;

int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  string a;
  cin>>a;

  long long i = 0, j = a.length()-1;

  while(i < j) {

    if(a[i] == a[j]) {
      i++;
      j--;
      continue;
    }

    break;

  }

  long long Resenje = a.length()-2*i-1;
  if(Resenje == 0) cout<<1;
  else cout<<Resenje;

  return 0;
}