#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int sz = 0;
  cin >> s;
  for (int i = s.size() - 1; i >= 0; i--) {
    sz = 0;
    for (int j = 0; j <= i; j++)
      if (s[j] != s[i - j]) {
        sz = i;
        break;
      }
    if (sz != 0) break;
  }
  cout << ((sz == 0) ? 0 : sz + 1) << endl;
  return 0;
}
