#include <bits/stdc++.h>
using namespace std;
mt19937 mt_rand(chrono::system_clock::now().time_since_epoch().count());
template <typename T1, typename T2>
inline bool upmax(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool upmin(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int maxn = (int)3e5 + 10;
const int base = 2147483647;
const long double PI = acos(-1.);
char s[maxn];
bool is(int l, int r) {
  bool ok = true;
  while (l < r) {
    ok &= s[l] == s[r];
    l++;
    r--;
  }
  return ok;
}
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      if (!is(i, j)) {
        ans = max(ans, j - i + 1);
      }
    }
  }
  cout << ans;
  return 0;
}
