結果
問題 |
No.1617 Palindrome Removal
|
ユーザー |
![]() |
提出日時 | 2025-06-12 20:40:23 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 311 bytes |
コンパイル時間 | 230 ms |
コンパイル使用メモリ | 82,144 KB |
実行使用メモリ | 96,728 KB |
最終ジャッジ日時 | 2025-06-12 20:40:41 |
合計ジャッジ時間 | 2,732 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 WA * 2 |
ソースコード
S = input().strip() def is_palindrome(s): return s == s[::-1] def all_same(s): return len(set(s)) == 1 if not is_palindrome(S): print(len(S)) else: if all_same(S): if len(S) % 2 == 0: print(0) else: print(-1) else: print(max(0, len(S) - 2))