#include <bits/stdc++.h>
using namespace std;
bool palin(string s, int k) {
  int p = 0;
  while (k > p) {
    if (s[p] != s[k]) return false;
    p++;
    k--;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  int k = (int)s.size() - 1;
  int ile = 0;
  if (k == 0) {
    cout << 0 << endl;
    return 0;
  }
  while (palin(s, k) and k > 0) {
    ile++;
    if (k == 1) {
      cout << 0 << endl;
      return 0;
    }
    k--;
  }
  cout << k + 1 << endl;
  return 0;
}
