#include using namespace std; int main() { string s; cin >> s; auto r = s; reverse(r.begin(), r.end()); const int n = s.size(); set st; for (int i = 0; i < n; ++i) { for (int j = 1; i + j <= n && j < n; ++j) st.insert(s.substr(i, j)); } int res = 0; for (int i = 0; i < n; ++i) { for (int j = 1; i + j <= n && j < n; ++j) { if (st.count(r.substr(i, j))) res = max(res, j); } } cout << res << endl; }