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;
const long long maxn=1e4+10;
const long long mod=1e9+7;
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
string s;
cin>>s;
int n=s.size();
map<string,int>m;
for(int i=0;i<n;i++)
{
int l=i;
int r=i;
while(l-1>=0 && r+1<n)
{
if(s[l-1]==s[r+1])
{
l--;
r++;
}
else
{
break;
}
}
string str="";
for(int j=l;j<=r;j++)
{
str+=s[j];
}
m[str]++;
}
for(int i=0;i<n-1;i++)
{
int l=i;
int r=i+1;
if(s[l]!=s[r])continue;
while(l-1>=0 && r+1<n)
{
if(s[l-1]==s[r+1])
{
l--;
r++;
}
else
{
break;
}
}
string str="";
for(int j=l;j<=r;j++)
{
str+=s[j];
}
m[str]++;
}
long long ans=0;
for(auto ax:m)
{
long long num=ax.first.size()*ax.second;
ans=max(num,ans);
}
cout<<ans<<endl;
return 0;
}
# | 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... |