#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[60];
  while (scanf("%s", s) == 1) {
    int k = strlen(s);
    int sum = 0;
    for (int i = 0; i < k / 2; i++) {
      if (s[i] == s[k - i - 1]) sum++;
    }
    int ans = k;
    if (sum == k / 2) ans -= 1;
    int t = 0;
    if (ans == k - 1) {
      for (int i = 1; i <= (k - 1) / 2; i++) {
        if (s[i] == s[k - i]) t++;
      }
      if (t == (k - 1) / 2) ans = 0;
    }
    printf("%d\n", ans);
  }
  return 0;
}
