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(){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
string s; cin >> s;
int n = s.length();
int ans = 0;
for(int i = 0; i < n; ++i){
char tmp = s[i];
for(int j = 0; j < 26; ++j){
s[i] = 'a' + j;
int cnt = 0;
for(int k = 0; k < n; ++k){
int l = k, r = k;
while(l >= 0 && r < n && s[l] == s[r]){
++cnt;
--l; ++r;
}
}
for(int k = 1; k < n; ++k){
int l = k - 1, r = k;
while(l >= 0 && r < n && s[l] == s[r]){
++cnt;
--l; ++r;
}
}
ans = max(ans, cnt);
}
s[i] = tmp;
}
cout << ans << '\n';
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... |