#include typedef long long ll; using namespace std; int INF = 1e9; int MOD = 1e9+7; main(){ string s; int maxlen = 1; cin >> s; for(int i = 0;i < s.length()-1;i++){ for(int j = i+1;j < s.length();j++){ if(i+(j-i)*2 > s.length())break; string sub = s.substr(i,j-i); reverse(sub.begin(),sub.end()); if(sub == s.substr(j,j-i)&& s.length() != (j-i)*2){ maxlen = max(maxlen,(j-i)*2); } if(i+(j-i)*2 >= s.length())continue; if(sub == s.substr(j+1,j-i) && s.length() != (j-i)*2+1){ maxlen = max(maxlen,(j-i)*2+1); } } } cout << maxlen << endl; }