結果
| 問題 | No.588 空白と回文 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-11-03 22:39:32 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 619 bytes | 
| コンパイル時間 | 1,615 ms | 
| コンパイル使用メモリ | 168,840 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-22 16:01:17 | 
| 合計ジャッジ時間 | 2,345 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 25 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    string s2 = "";
    s2 += s[0];
    for (int i = 1; i < s.size(); i++) {
        s2 += " ";
        s2 += s[i];
    }
    int ans = 0;
    for (int i = 0; i < s2.size(); i++) {
        int cnt = (s2[i] != ' ');
        for (int j = 1; ; j++) {
            if (i - j < 0 || i + j >= s2.size()) break;
            cnt += (s2[i - j] == s2[i + j] && s2[i - j] != ' ') * 2;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}
            
            
            
        