#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  while (true) {
    string k = s;
    reverse(k.begin(), k.end());
    if (k == s) {
      string f = "";
      if (s.size() == 1) {
        cout << 0, exit(0);
      }
      for (int i = 0; i < s.size() - 1; i++) {
        f += s[i];
      }
      s = f;
    } else
      cout << s.size(), exit(0);
  }
  return 0;
}
