結果

問題 No.1617 Palindrome Removal
ユーザー 👑 rin204rin204
提出日時 2022-01-18 02:50:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 198 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 96,512 KB
最終ジャッジ日時 2024-05-02 19:13:14
合計ジャッジ時間 2,708 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
95,872 KB
testcase_01 AC 102 ms
96,512 KB
testcase_02 AC 106 ms
95,872 KB
testcase_03 AC 102 ms
96,000 KB
testcase_04 AC 100 ms
96,256 KB
testcase_05 AC 100 ms
94,976 KB
testcase_06 AC 51 ms
59,008 KB
testcase_07 AC 46 ms
55,808 KB
testcase_08 AC 35 ms
51,328 KB
testcase_09 AC 33 ms
51,584 KB
testcase_10 AC 103 ms
95,488 KB
testcase_11 AC 102 ms
94,848 KB
testcase_12 AC 110 ms
96,384 KB
testcase_13 AC 108 ms
96,384 KB
testcase_14 AC 36 ms
51,712 KB
testcase_15 AC 33 ms
51,456 KB
testcase_16 AC 33 ms
51,456 KB
testcase_17 AC 33 ms
51,584 KB
testcase_18 AC 34 ms
51,584 KB
testcase_19 AC 34 ms
51,456 KB
testcase_20 AC 33 ms
51,584 KB
testcase_21 AC 33 ms
51,456 KB
testcase_22 AC 36 ms
51,456 KB
testcase_23 AC 35 ms
51,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
if S != S[::-1]:
    print(len(S))
elif len(set(S)) == 1:
    if len(S) % 2 == 1:
        print(-1)
    else:
        print(0)
elif len(S) == 3:
    print(-1)
else:
    print(len(S) - 2)
0