結果
問題 |
No.1617 Palindrome Removal
|
ユーザー |
![]() |
提出日時 | 2022-02-03 14:19:52 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 419 bytes |
コンパイル時間 | 336 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 141,192 KB |
最終ジャッジ日時 | 2024-06-11 09:55:41 |
合計ジャッジ時間 | 3,655 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 WA * 2 |
ソースコード
s = list(map(str,input())) ans = len(s) elem = set() flag = True for i in range(ans//2): if(s[i] != s[ans-1-i]): flag = False break else: elem.add(s[i]) if((ans % 2 != 0) & (ans // 2 > 0)): elem.add(s[i+1]) if(flag): if(len(elem) == 1): if(ans % 2 == 0): print(0) else: print(-1) else: print(ans - 2) else: print(ans)