#include <bits/stdc++.h>
const double PI = 3.1415926;
const int KL = 1e6;
using namespace std;
long long q, x, y, z, n, m, p[KL], mn = 1e9, mx = -1e9, ans;
string t;
vector<int> vec;
set<int> s;
map<int, int> M;
bool check(string st) {
  m = st.size();
  for (int i = 0; i < m; i++) {
    if (st[i] != st[m - i - 1]) return true;
  }
  return false;
}
int main() {
  cin >> t;
  n = t.size();
  ans = 0, mx = -1;
  for (int i = 0; i < n - 1; i++) {
    string s;
    s += t[i];
    for (int j = i + 1; j < n; j++) {
      s += t[j];
      if (check(s)) ans = s.size();
      mx = max(mx, ans);
    }
  }
  mn = 0;
  cout << max(mx, mn);
  return 0;
}
