結果

問題 No.588 空白と回文
ユーザー ミドリムシ
提出日時 2017-11-03 23:12:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 653 ms
コンパイル使用メモリ 57,848 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-23 14:53:33
合計ジャッジ時間 2,371 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
    string S;
    cin >> S;
    int ans = 0;
    for(int i = 0; i < S.size(); i++){
        for(int j = i; j < S.size(); j++){
            int count = 0;
            for(int k = 0; k <= j - i; k++){
                if(S[i + k] == S[j - k]){
                    count++;
                }
            }
            ans = max(ans, count);
        }
    }
    cout << ans << endl;
}
0