#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 |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
596 KB |
Output is correct |
4 |
Correct |
2 ms |
568 KB |
Output is correct |
5 |
Correct |
2 ms |
596 KB |
Output is correct |
6 |
Correct |
786 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |