#include <bits/stdc++.h>
using namespace std;
bool ss(string x) {
  int l = 0, r = x.size() - 1;
  while (l <= r) {
    if (x[l] != x[r]) return false;
    l++;
    r--;
  }
  return true;
}
int main() {
  string s;
  cin >> s;
  for (int i = s.size(); i >= 1; i--) {
    for (int j = 0; j <= s.size() - i; j++) {
      if (ss(s.substr(j, i)) == false) {
        cout << i << endl;
        return 0;
      }
    }
  }
  cout << 0 << endl;
  return 0;
}
