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;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
int ans=0;
int n=s.size();
for (int i=0; i<n; ++i) for (int j=i; j<n; ++j){
string t=s.substr(i, j-i+1);
string rt(t.rbegin(), t.rend());
if (t!=rt) continue;
int cnt=0;
for (int k=0; k+j-i<n; ++k) if (s.substr(k, j-i+1)==t) ++cnt;
ans=max(ans, (j-i+1)*cnt);
}
cout << ans;
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... |