Submission #918032

#TimeUsernameProblemLanguageResultExecution timeMemory
918032ezzzayPalindromes (APIO14_palindrome)C++14
0 / 100
1077 ms1260 KiB
#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+1;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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...