/* -*- coding: utf-8 -*- * * 588.cc: No.588 空白と回文 - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ /* typedef */ /* global variables */ /* subroutines */ /* main */ int main() { string s; cin >> s; int n = s.size(); int maxl = 0; // center == s[i] for (int i = 0; i < n; i++) { int l = 1; for (int j = i - 1, k = i + 1; j >= 0 && k < n; j--, k++) if (s[j] == s[k]) l += 2; if (maxl < l) maxl = l; } // center == between s[i] and s[i + 1] for (int i = 0; i < n; i++) { int l = 0; for (int j = i, k = i + 1; j >= 0 && k < n; j--, k++) if (s[j] == s[k]) l += 2; if (maxl < l) maxl = l; } printf("%d\n", maxl); return 0; }