結果
| 問題 |
No.1617 Palindrome Removal
|
| コンテスト | |
| ユーザー |
vltmtt
|
| 提出日時 | 2021-07-22 22:40:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 115 ms / 2,000 ms |
| コード長 | 383 bytes |
| コンパイル時間 | 910 ms |
| コンパイル使用メモリ | 82,332 KB |
| 実行使用メモリ | 77,228 KB |
| 最終ジャッジ日時 | 2024-07-17 18:57:56 |
| 合計ジャッジ時間 | 3,058 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
from collections import Counter
x = input()
if len(x) >= 4:
c = Counter(x)
if len(c) == 1:
print(-(len(x)%2))
else:
for i in range(len(x)//2):
if x[i] != x[-i-1]:
print(len(x))
break
else:
print(len(x)-2)
else:
if x[0] == x[-1]:
print(-(len(x)%2))
else:
print(len(x))
vltmtt