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() {
int n, ans = 0;
cin >> n;
string str;
cin >> str;
for(int i = 0; i < n; i++) {
int j, k;
for(j = i, k = i; j>=0&&k<n; j--,k++) {
if(str[j]!=str[k]) {
break;
}
}
ans = max(ans, k-j-1);
for(j = i, k = i+1; j>=0&&k<n; j--,k++) {
if(str[j]!=str[k]) {
break;
}
}
ans = max(ans, k-j-1);
}
cout << ans << '\n';
}
# | 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... |