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;
bool pal(string s){
int l = 0, r = (int)s.size() - 1;
while(l < r){
if(s[l] != s[r])
return 0;
l++, r--;
}
return 1;
}
int main(){
string s;
cin >> s;
int n = (int)s.size();
unordered_map<string, int> mp;
for(int i = 0; i < n; ++i){
string str = "";
for(int j = i; j < n; ++j){
str += s[j];
if(pal(str))
mp[str]++;
}
}
int jog = -1;
for(auto &to : mp)
jog = max(jog, (int)to.first.size()*to.second);
printf("%d\n", jog);
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... |