結果

問題 No.1617 Palindrome Removal
ユーザー hir355hir355
提出日時 2021-07-22 21:28:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 95,464 KB
最終ジャッジ日時 2023-09-24 15:37:24
合計ジャッジ時間 4,008 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
93,800 KB
testcase_01 AC 117 ms
94,312 KB
testcase_02 AC 125 ms
95,192 KB
testcase_03 AC 125 ms
94,804 KB
testcase_04 AC 130 ms
95,372 KB
testcase_05 AC 121 ms
94,104 KB
testcase_06 AC 132 ms
95,464 KB
testcase_07 AC 119 ms
92,384 KB
testcase_08 AC 72 ms
71,344 KB
testcase_09 AC 71 ms
71,316 KB
testcase_10 AC 131 ms
94,848 KB
testcase_11 AC 125 ms
94,100 KB
testcase_12 AC 135 ms
95,372 KB
testcase_13 AC 133 ms
95,336 KB
testcase_14 AC 71 ms
71,496 KB
testcase_15 AC 70 ms
71,344 KB
testcase_16 AC 72 ms
71,276 KB
testcase_17 AC 72 ms
71,376 KB
testcase_18 AC 70 ms
71,372 KB
testcase_19 AC 72 ms
71,096 KB
testcase_20 AC 73 ms
71,304 KB
testcase_21 AC 71 ms
71,480 KB
testcase_22 AC 72 ms
71,372 KB
testcase_23 AC 72 ms
71,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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