#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (long long i = 0; i < v.size(); i++) is >> v[i];
  return is;
}
template <class T>
ostream &operator<<(ostream &os, vector<T> v) {
  for (long long i = 0; i < v.size(); i++) os << v[i] << ' ';
  os << '\n';
  return os;
}
long long gcd(long long a, long long b) { return (a == 0) ? b : gcd(b % a, a); }
bool is_pal(string s) {
  for (long long i = 0, j = s.size() - 1; i < s.size() / 2; i++, j--)
    if (s[i] != s[j]) return false;
  return true;
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  string s;
  cin >> s;
  for (long long len = s.size(); len >= 1; len--)
    for (long long l = 0; l + len - 1 < s.size(); l++)
      if (!is_pal(s.substr(l, len))) {
        cout << len;
        return 0;
      }
  cout << 0;
}
