This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000010
#define ii pair<int,int>
#define fs first
#define sc second
#define ld double
string s;
int n;
map<string,int>mp;
int solve(int k)
{
int cnt=0;
mp.clear();
for(int i=1;i<=n-k+1;i++)
cnt=max(cnt,++mp[s.substr(i,k)]);
return cnt*k;
}
int main()
{
#ifdef SKY
freopen("A.inp","r",stdin);
freopen("A.out","w",stdout);
#endif // SKY
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin>>s;
n=s.size();
s=" "+s;
int res=0;
for(int i=1;i<=n;i++)
{
int val=solve(i);
res=max(res,val);
}
cout<<res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |