#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &a) {
  static char c;
  int f = 0;
  while (((c = getchar()) < '0' || c > '9') && (c != '-'))
    ;
  if (c == '-') {
    a = 0;
    f = 1;
  } else {
    a = c - '0';
  }
  while ((c = getchar()) <= '9' && c >= '0') a = (a << 3) + (a << 1) + c - '0';
  if (f) a = -a;
}
int a[100005], n, m;
char s[10005];
int main() {
  int i, j, k, l, ans = 0;
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (i = 1; i <= n; i++) {
    for (j = i; j <= n; j++) {
      int tag = 1;
      for (k = i; k <= j; k++) {
        if (s[k] != s[i + j - k]) {
          tag = 0;
          break;
        }
      }
      if (!tag) ans = max(ans, j - i + 1);
    }
  }
  printf("%d\n", ans);
  return 0;
}
