// #include using namespace std; #define ll long long #define pii pair #define fi first #define se second #define rep(i, x, y) for (int i = (x); i <= (y); i ++ ) #define per(i, x, y) for (int i = (x); i >= (y); i -- ) const int N = 5e5 + 5, M = 1e6 + 5; const int inf = 1e9, mod = 998244353; const ll INF = 1e18, RMX = 2324814; mt19937 rd(time(0)); uniform_int_distribution dist(0, RMX); string s; signed main(){ ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> s; int n = s.size(); int res = 0; rep(i, 1, n){ int qwq = -1; int l = i, r = i; while (l >= 1 && r <= n) qwq += (s[l - 1] == s[r - 1]) * 2, l --, r ++ ; res = max(res, qwq); } rep(i, 1, n - 1){ int qwq = 0; int l = i, r = i + 1; while (l >= 1 && r <= n) qwq += (s[l - 1] == s[r - 1]) * 2, l --, r ++ ; res = max(res, qwq); } cout << res << "\n"; }