#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define all(v) v.begin(), v.end() #define mset(a, n) memset(a, n, sizeof(a)) typedef long long ll; typedef vector vi; typedef pair pii; const int inf = 1000000000; const int mod = 1000000007; const double eps = 1e-9; int main() { // cin.tie(0); // tie // ios::sync_with_stdio(false); // sync string S; cin >> S; int ans = 0; REP(i, 1, S.size()) { REP(j, 1, S.size() - i + 1) { string tmp = S.substr(i, j); rep(k, tmp.size() / 2 + 1) { if (tmp[k] != tmp[tmp.size() - 1 - k]) break; if (k == (int)tmp.size() / 2) ans = max(ans, (int)tmp.size()); } } } cout << ans << endl; return 0; }