#include #include #include #include using namespace std; #define endl '\n' #define ALL(a) (a).begin(),(a).end() #define SZ(a) int((a).size()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define DEBUG(x) cout<<#x<<": "< P; typedef long long int LL; typedef pair LP; bool check_Palindrome(string s); int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; //cout << check_Palindrome(s) << endl; int n = SZ(s); int ans = -1; REP(i,n){ REP(j,i+1){ if(i == n-1 && j == 0) continue; if(check_Palindrome(s.substr(j,i-j+1))){ //DEBUG(i); DEBUG(j); cout << i-j+1 << endl << endl; ans = max(ans,i-j+1); } } } cout << ans << endl; return 0; } bool check_Palindrome(string s){ bool res = true; for(int i = 0; i < SZ(s); i++){ if(s[i] != s[SZ(s)-1-i]) res = false; } return res; }