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;
int main(){
#ifdef prince
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
cin.tie(nullptr)->sync_with_stdio(false);
string s;cin>>s;
int n=s.size();
map<string,int>mp;
// string a;a+=s[0];mp[a]++;a="";a+=s[n-1];mp[a]++;
for(int i=0;i<n;++i){
string p1;
p1+=s[i];
int l=i-1,r=i+1;
while(l>=0&&r<n&&s[l]==s[r]){
mp[p1]++;
p1+=s[l];p1+=s[r];
l--;r++;
}
mp[p1]++;
string p2;
l=i-1;r=i;
while(l>=0&&r<n&&s[l]==s[r]){
p2+=s[l];p2+=s[r];
mp[p2]++;
l--;r++;
}
}
int mx=0;
for(auto &[x,y]:mp){
// cout<<x<<" "<<y<<endl;
mx=max(mx,(int)x.size()*y);
}
cout<<mx;
}
# | 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... |