結果

問題 No.588 空白と回文
コンテスト
ユーザー lloyz
提出日時 2022-08-28 09:43:54
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 395 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 184 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 78,080 KB
最終ジャッジ日時 2026-05-04 00:49:01
合計ジャッジ時間 7,884 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

S = input()

n = len(S)
ans = 1
for i in range(n):
    j = 1
    res = 1
    while i - j >= 0 and i + j < n:
        if S[i - j] == S[i + j]:
            res += 2
        j += 1
    ans = max(ans, res)
for i in range(n - 1):
    j = 0
    res = 0
    while i - j >= 0 and i + j + 1 < n:
        if S[i - j] == S[i + j + 1]:
            res += 1
        j += 1
    ans = max(ans, res)
print(ans)
0