#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-6;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 1; i + j <= n; j++) {
      string t = s.substr(i, j);
      string tt = t;
      reverse(tt.begin(), tt.end());
      if (t != tt) ans = max(ans, j);
    }
  }
  cout << ans << endl;
  return 0;
}
