#include<iostream> #include<cstdio> #include<cstring> #include <cstdlib> #include <cmath> #include<cctype> #include<string> #include<set> #include<iomanip> #include <map> #include<algorithm> #include <functional> #include<vector> #include<climits> #include<stack> #include<queue> #include <deque> #include <climits> #include <typeinfo> #include <utility> #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(int i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(int i = m;i >= n;--i) #define INF INT_MAX/2 using namespace std; using ll = long long; using R = double; const ll MOD = 1e9 + 7; const ll inf = 1LL << 50; struct edge { ll from; ll to; ll cost; }; int main() { string s; cin >> s; int sz = s.size(); for (int i = sz-1; i >= 1; --i) { for (int j = 0; j + i <= sz ; ++j) { string s1 = ""; string s2 = ""; for (int k = j; k <= j + i - 1; ++k) { s1 += s[k]; } for (int k = j + i - 1; k >= j; --k) { s2 += s[k]; } if (s1 == s2) { cout << i << endl; return 0; } } } return 0; }