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 fun(string s){
int n=s.size();
for(int i=0;i<n;i++){
if(s[i]!=s[n-i-1])return 0;
}
return 1;
}
signed main(){
string s;
cin>>s;
int n=s.size();
int ans=0;
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
string p= s.substr(i,j-i+1);
int z=0;
if(fun(p)){
z+=j-i+1;
for(int l=j+1;l<n;l++){
if(s.substr(l,j-i+1)==p){
z+=j-i+1;
}
}
}
ans=max(ans,z);
}
}
cout<<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... |