#include <bits/stdc++.h>
using namespace std;
bool ok(string k) {
  string x = k;
  reverse(k.begin(), k.end());
  return x == k;
}
int main() {
  int ans = 0;
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    int temp = 1;
    string ss = "";
    ss += s[i];
    for (int j = i + 1; j < s.length(); j++) {
      ss += s[j];
      temp++;
      if (!ok(ss)) {
        ans = max(ans, temp);
      }
    }
  }
  cout << ans;
}
