#include <bits/stdc++.h>
using namespace std;
const int maxS = 1001;
int n;
char s[maxS];
int f[maxS][maxS];
int main() {
  cin >> s;
  n = strlen(s);
  int res = 0;
  for (int i = 0; i < n; i++) f[i][i] = 1;
  for (int l = 1; l < n; l++) {
    for (int i = 0; i < n; i++) {
      int j = i + l;
      if (j >= n) break;
      if (s[i] == s[j]) {
        if (f[i + 1][j - 1] == 1 || l == 1) {
          f[i][j] = 1;
        }
      }
      if (f[i][j] != 1) {
        res = max(res, l + 1);
      }
    }
  }
  cout << res << endl;
  return 0;
}
