( ext{Code})
#include<cstdio>
#include<cstring>
#include<iostream>
#define LL long long
#define re register
using namespace std;
const int N = 3e5 + 5;
char str[N];
struct PAM{
int size, last, tot, tr[N][26], cnt[N], fail[N], len[N];
char s[N];
inline int Node(int l)
{
++size;
for(re int i = 0; i < 26; i++) tr[size][i] = 0;
len[size] = l, fail[size] = cnt[size] = 0;
return size;
}
inline void clear()
{
size = -1, s[last = tot = 0] = '$';
Node(0), Node(-1), fail[0] = 1;
}
inline int getfail(int x)
{
while (s[tot - len[x] - 1] != s[tot]) x = fail[x];
return x;
}
inline void insert(int x)
{
s[++tot] = str[x];
int u = getfail(last), ch = str[x] - 'a';
if (!tr[u][ch])
{
int v = Node(len[u] + 2);
fail[v] = tr[getfail(fail[u])][ch], tr[u][ch] = v;
}
++cnt[last = tr[u][ch]];
}
inline LL query()
{
for(re int i = size; i >= 0; i--) cnt[fail[i]] += cnt[i];
LL ans = 0;
for(re int i = 1; i <= size; i++) ans = max(ans, 1LL * cnt[i] * len[i]);
return ans;
}
}P;
int main()
{
P.clear();
scanf("%s", str);
int len = strlen(str);
for(re int i = 0; i < len; i++) P.insert(i);
printf("%lld
", P.query());
}