#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
212 KB |
Output is correct |
2 |
Correct |
17 ms |
368 KB |
Output is correct |
3 |
Correct |
5 ms |
212 KB |
Output is correct |
4 |
Correct |
3 ms |
212 KB |
Output is correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1083 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1084 ms |
468 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |