結果

問題 No.588 空白と回文
ユーザー lloyz
提出日時 2022-08-28 09:44:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 75,372 KB
最終ジャッジ日時 2024-10-15 08:43:04
合計ジャッジ時間 2,229 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
    j = 0
    res = 0
    while i - j >= 0 and i + j + 1 < n:
        if S[i - j] == S[i + j + 1]:
            res += 2
        j += 1
    ans = max(ans, res)
print(ans)
0