#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using pii = pair<int, int>;
struct Solver {
  string s;
  void read(istream& in) { in >> s; }
  void solve(ostream& out) {
    const int n = s.size();
    int bs = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = i; j < n; ++j) {
        string tmp = s.substr(i, j - i + 1);
        string tmp2 = tmp;
        reverse(tmp2.begin(), tmp2.end());
        if (tmp != tmp2) bs = max<int>(bs, tmp.size());
      }
    }
    out << bs << endl;
  }
};
int main() {
  int T = 1;
  for (int t = 1; t <= T; ++t) {
    Solver solver;
    solver.read(cin);
    solver.solve(cout);
  }
}
