제출 #765680

#제출 시각아이디문제언어결과실행 시간메모리
765680boyliguanhanLampice (COCI19_lampice)C++17
25 / 110
786 ms632 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...