#include <bits/stdc++.h>
int main() {
  char a[100], b[100];
  int j = 0;
  gets(a);
  int i;
  int result;
  for (i = strlen(a) - 1; i >= 0; i--) {
    b[j++] = a[i];
  }
  b[j] = '\0';
  if (strcmp(a, b) == 0) {
    for (i = 0; i < strlen(a) / 2; i++) {
      if (a[i] != a[i + 1]) {
        result = strlen(a) - 1;
        break;
      } else
        result = 0;
    }
  }
  if (strcmp(a, b) != 0) {
    result = strlen(a);
  }
  printf("%d", result);
}
