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;
long long int ans;
map<string,int> m;
map<string,int>::iterator mit;
string s;
void Insert()
{
int tam = s.size();
for(int i=0;i<tam;i++)
{
string aux;
int maxt = min( i+1, tam-i );
for(int j=0;j<maxt;j++)
{
if( s[i+j] != s[i-j] ) break;
aux.push_back(s[i+j]);
if(m.find(aux) == m.end()) m.insert({aux,1});
else m[aux]++;
}
}
return;
}
int main()
{
cin >> s;
Insert();
for(mit = m.begin();mit!=m.end();mit++)
{
int tam = (mit->first).size(), qtd = mit->second;
ans = max( ans , (long long int) qtd*(2*tam-1) );
}
printf("%lld",ans);
}
# | 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... |