結果

問題 No.1617 Palindrome Removal
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-07-22 21:46:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 134,020 KB
最終ジャッジ日時 2023-09-24 16:22:11
合計ジャッジ時間 6,322 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 189 ms
123,408 KB
testcase_01 AC 192 ms
125,864 KB
testcase_02 AC 228 ms
131,708 KB
testcase_03 AC 227 ms
130,584 KB
testcase_04 AC 238 ms
134,020 KB
testcase_05 AC 206 ms
122,276 KB
testcase_06 AC 207 ms
133,776 KB
testcase_07 AC 166 ms
106,800 KB
testcase_08 AC 92 ms
71,420 KB
testcase_09 AC 94 ms
71,532 KB
testcase_10 AC 229 ms
129,788 KB
testcase_11 AC 210 ms
122,536 KB
testcase_12 AC 237 ms
133,852 KB
testcase_13 AC 239 ms
133,808 KB
testcase_14 AC 95 ms
71,580 KB
testcase_15 AC 93 ms
71,444 KB
testcase_16 AC 94 ms
71,524 KB
testcase_17 AC 93 ms
71,688 KB
testcase_18 AC 93 ms
71,312 KB
testcase_19 AC 94 ms
71,428 KB
testcase_20 AC 94 ms
71,564 KB
testcase_21 AC 93 ms
71,224 KB
testcase_22 AC 94 ms
71,536 KB
testcase_23 AC 93 ms
71,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
s = list(input())
c = Counter(s)
if len(c) == 1:
    if len(s) & 1:
        print(-1)
    else:
        print(0)
elif s != s[::-1]:
    print(len(s))
else:
    if len(s) == 3:
        print(-1)
    else:
        print(len(s)-2)
0