#include #include #include #include #include #include #include #include #include #define rep(i, a) FOR(i, 0, a) #define FOR(i, a, b) for(int i = a; i < b; ++i) typedef long long ll; typedef unsigned long long ull; typedef std::pair P; struct edge{ int to, time, cost; }; std::string str; int dp[51]; int main(){ std::cin >> str; dp[0] = 0; rep(i, str.size()){ for (int j = i + 1; j <= str.size(); ++j){ if (j - i == str.size())continue; std::string s = str.substr(i, j - i); if (s == std::string(s.rbegin(), s.rend()))dp[j] = std::max({ dp[j], dp[i], j - i }); } } std::cout << dp[str.size()] << std::endl; return 0; }