結果
問題 | No.588 空白と回文 |
ユーザー |
|
提出日時 | 2018-06-20 21:08:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 539 bytes |
コンパイル時間 | 85 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-06-30 17:27:14 |
合計ジャッジ時間 | 2,507 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 9 |
ソースコード
from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): S = input() leng = len(S) ans = 0 for i in range(1, leng - 1): cnt, l, r = 1, i - 1, i + 1 while 1: if S[l] == S[r]: cnt += 2 elif S[i] == S[l] or S[i] == S[r]: cnt = max(2, cnt) ans = max(ans, cnt) if l > 0 and r < leng - 1: l -= 1; r += 1 else: break print(ans) main()