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