#include <bits/stdc++.h>
using namespace std;
int n, ans;
char a[55];
bool ok(int l, int r) {
  for (int i = l; i <= r; i++)
    if (a[i] != a[r - i + l]) return 1;
  return 0;
}
signed main() {
  scanf("%s", a + 1);
  n = strlen(a + 1);
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      if (ok(i, j)) ans = max(ans, j - i + 1);
  cout << ans;
  return 0;
}
