結果

問題 No.1617 Palindrome Removal
ユーザー titiatitia
提出日時 2021-07-22 22:15:38
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 196 bytes
コンパイル時間 825 ms
コンパイル使用メモリ 10,488 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2023-09-24 17:21:01
合計ジャッジ時間 2,485 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,856 KB
testcase_01 AC 32 ms
9,876 KB
testcase_02 AC 30 ms
9,824 KB
testcase_03 AC 30 ms
9,892 KB
testcase_04 AC 31 ms
9,848 KB
testcase_05 AC 29 ms
9,528 KB
testcase_06 AC 32 ms
9,872 KB
testcase_07 AC 26 ms
9,124 KB
testcase_08 AC 15 ms
7,840 KB
testcase_09 AC 16 ms
7,892 KB
testcase_10 AC 32 ms
9,720 KB
testcase_11 AC 29 ms
9,644 KB
testcase_12 AC 32 ms
9,984 KB
testcase_13 AC 34 ms
9,844 KB
testcase_14 AC 15 ms
7,872 KB
testcase_15 AC 16 ms
7,776 KB
testcase_16 AC 16 ms
7,864 KB
testcase_17 AC 17 ms
7,800 KB
testcase_18 AC 16 ms
7,768 KB
testcase_19 AC 16 ms
7,772 KB
testcase_20 AC 16 ms
7,772 KB
testcase_21 AC 15 ms
7,776 KB
testcase_22 AC 15 ms
7,776 KB
testcase_23 AC 15 ms
7,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
C=set(S)

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

0