#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const long long INFL = 1e18 + 123;
const double PI = atan2(0, -1);
mt19937 tw(960172);
long long rnd(long long x, long long y) {
  static uniform_int_distribution<long long> d;
  return d(tw) % (y - x + 1) + x;
}
bool check(string s) {
  string tmp = s;
  reverse(tmp.begin(), tmp.end());
  return tmp != s;
}
void solve() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < ((int)(s).size()); ++i) {
    string cur = "";
    for (int j = i; j < ((int)(s).size()); ++j) {
      cur += s[j];
      if (check(cur)) {
        ans = max(ans, j - i + 1);
      }
    }
  }
  cout << ans << "\n";
}
int main() {
  cerr << fixed << setprecision(15);
  cout << fixed << setprecision(15);
  ios::sync_with_stdio(false);
  int tests = 1;
  for (int it = 1; it <= tests; ++it) {
    solve();
  }
  return 0;
}
