#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, s1;
  cin >> s;
  while (s.size()) {
    s1 = s;
    reverse(s.begin(), s.end());
    if (s1 != s) break;
    s.pop_back();
  }
  cout << s.size() << endl;
}
