#include <bits/stdc++.h>
using namespace std;
bool checkpalin(char a[], int left, int right);
int main() {
  char a[10005];
  int i = 0, len;
  scanf("%s", a);
  len = strlen(a);
  while (a[i] == a[len - 1] && i < len && checkpalin(a, i, len - 1)) {
    i++;
  }
  printf("%d\n", len - i);
  return 0;
}
bool checkpalin(char a[], int left, int right) {
  int n, mid, j;
  mid = (left + right) / 2;
  j = 0;
  for (n = left; n <= mid; n++) {
    if (a[n] != a[right - j]) {
      return false;
    }
    j++;
  }
  return true;
}
