#include <bits/stdc++.h>
using namespace std;
FILE* in = stdin;
FILE* out = stdout;
const int MAX = 1024;
int n;
char a[MAX];
bool isPal(const string& str) {
  for (int i = 0; i < (int)str.size(); i++)
    if (str[i] != str[(int)str.size() - 1 - i]) return false;
  return true;
}
int main(void) {
  fscanf(in, "%s", a);
  n = (int)strlen(a);
  int ans = 0;
  for (int start = 0; start < n; start++) {
    for (int end = start; end < n; end++) {
      if (!isPal(string(a + start, a + end + 1)))
        ans = max(ans, end - start + 1);
    }
  }
  fprintf(out, "%d\n", ans);
  return 0;
}
