#include<iostream> #include<cstdio> #include<cstring> #define maxn 100010 #define ll long long usingnamespacestd;
int n;
char s[maxn];
int nxt[maxn], sum[maxn]; voidinit_nxt(char *s){ nxt[1] = 0; int k = 0, n = strlen(s + 1); for (int i = 2; i <= n; ++i) { while (k && s[i] != s[k + 1]) k = nxt[k]; if (s[i] == s[k + 1]) ++k; nxt[i] = k; ++sum[k]; } }
ll ans; intmain(){ scanf("%s", s + 1); n = strlen(s + 1); init_nxt(s); for (int i = n; i; --i) sum[nxt[i]] += sum[i]; for (int i = 1; i <= n; ++i) ans = max(ans, 1ll * i * (sum[i] + 1)); cout << ans << endl; return0; }