結果

問題 No.1617 Palindrome Removal
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-07-22 23:15:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 209 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 96,160 KB
最終ジャッジ日時 2023-09-24 19:19:34
合計ジャッジ時間 3,900 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
95,532 KB
testcase_01 AC 120 ms
95,712 KB
testcase_02 AC 117 ms
95,660 KB
testcase_03 AC 116 ms
95,288 KB
testcase_04 AC 117 ms
96,160 KB
testcase_05 AC 112 ms
94,212 KB
testcase_06 AC 81 ms
74,996 KB
testcase_07 AC 78 ms
73,524 KB
testcase_08 AC 69 ms
71,244 KB
testcase_09 AC 67 ms
71,240 KB
testcase_10 AC 127 ms
95,356 KB
testcase_11 AC 119 ms
94,412 KB
testcase_12 AC 125 ms
95,936 KB
testcase_13 AC 128 ms
95,788 KB
testcase_14 AC 70 ms
71,284 KB
testcase_15 AC 70 ms
71,164 KB
testcase_16 AC 69 ms
71,172 KB
testcase_17 AC 68 ms
71,532 KB
testcase_18 AC 68 ms
71,348 KB
testcase_19 AC 69 ms
71,332 KB
testcase_20 AC 69 ms
71,632 KB
testcase_21 AC 67 ms
71,180 KB
testcase_22 AC 67 ms
71,240 KB
testcase_23 AC 69 ms
71,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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