#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int l = str.length();
  for (int i = l; i >= 0; i--)
    for (int j = 0; j <= i / 2; j++)
      if (str[j] != str[i - j - 1]) {
        cout << i << endl;
        return 0;
      }
  puts("0");
  return 0;
}
