CCCPaste

Untitled

#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = (int) s.size();
    if(n <= 1000) {
        int res = 0;
        for(int i = 0; i < n; i++) {
            string tmp = "";
            for(int j = i; j < n; j++) {
                tmp += s[j];
                string rev_tmp = tmp;
                reverse(rev_tmp.begin(), rev_tmp.end());
                string x = tmp + rev_tmp + tmp + rev_tmp;
                if(s.find(x) != string::npos) {
                    res = max(res, (int) x.size());
                }
            }
        }
        cout << res << endl;
    }
    
    return 0;
}