#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[100];
  int k;
  while (scanf("%s", s) == 1) {
    int z = 0;
    for (k = 0; k < strlen(s) - 1; k++) {
      if (s[k] == s[k + 1]) {
        z++;
      }
    }
    if (z == strlen(s) - 1) {
      cout << "0" << endl;
      return 0;
    }
    {
      int i = 0, j = strlen(s) - 1, flag = 0;
      for (i = 0; i < strlen(s); ++i, --j) {
        if (s[i] == s[j]) {
          continue;
        } else {
          flag = 1;
          break;
        }
      }
      if (flag == 0) {
        cout << strlen(s) - 1 << endl;
      } else {
        cout << strlen(s) << endl;
      }
    }
  }
}
