#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[50];
  cin >> a;
  int b, c, j = 0, k = 0;
  for (c = 0; a[c]; c++)
    ;
  for (b = 0; b < c / 2; b++) {
    if (a[b] != a[c - b - 1]) j = 1;
  }
  if (j == 1)
    cout << c << endl;
  else {
    c = c - 1;
    j = 0;
    for (b = 0; b < c / 2; b++) {
      if (a[b] != a[c - b - 1]) j = 1;
    }
    if (j == 1)
      cout << c << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}
