#include #include #include #include #include #include #include using namespace std; string s; int func(int start,int end){ vector p; for(int i=start; i<=end; i++){ p.push_back(s[i]); } int count=0; for(int i=0; i> s; int left_side = 0; int right_side = 0; int ans = 1; bool judge=false; /* cout << s.length() << endl;*/ for (int k = 0; k < s.length() - 3; k++) { for (int i = 1; i < s.length() - 1-k; i++) { judge =false; left_side = i; right_side = i+k; int tmp = func(left_side,right_side); while (left_side != 0 && right_side != s.length() - 1) { if (s[--left_side] == s[++right_side]) { tmp += 2; judge =true; } } if(judge) ans = max(ans, tmp); } } if (ans == 1) { cout << ans << endl; } else { cout << ans << endl; } return 0; }