#include const static double de_PI = 3.14159265358979323846; const static int de_MOD = 1000000007; const static int de_MAX = 999999999; const static int de_MIN = -999999999; int main(void) { //std::ifstream in("123.txt"); std::cin.rdbuf(in.rdbuf()); std::string S; std::cin >> S; unsigned int max = 1; for (unsigned int i = 0; i < S.length() - 1; i++) { unsigned int temp = 0; for (unsigned int j = S.length() - 1; j > i; j--) { if (j == S.length() - 1 && i == 0) { continue; } if (S[i] == S[j]) { bool flg = true; temp = j - i + 1; unsigned int k = 1; while (k <= temp / 2 - 1) { if (S[i + k] != S[j - k]) { flg = false; break; } k++; } if (flg) { if (temp > max) { max = temp; break; } } } } } std::cout << max << std::endl; }