#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 |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
604 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
860 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
206 ms |
50112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
546 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
558 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |