結果

問題 No.1617 Palindrome Removal
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-07-22 23:15:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 215 bytes
コンパイル時間 1,556 ms
コンパイル使用メモリ 86,188 KB
実行使用メモリ 102,116 KB
最終ジャッジ日時 2023-09-24 19:19:45
合計ジャッジ時間 3,700 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
101,364 KB
testcase_01 AC 129 ms
101,832 KB
testcase_02 AC 124 ms
101,324 KB
testcase_03 AC 124 ms
101,316 KB
testcase_04 AC 126 ms
102,116 KB
testcase_05 AC 120 ms
99,212 KB
testcase_06 AC 80 ms
75,196 KB
testcase_07 AC 75 ms
73,604 KB
testcase_08 AC 66 ms
71,588 KB
testcase_09 AC 65 ms
71,404 KB
testcase_10 AC 124 ms
100,908 KB
testcase_11 AC 121 ms
99,296 KB
testcase_12 AC 127 ms
101,860 KB
testcase_13 AC 123 ms
102,024 KB
testcase_14 AC 70 ms
71,172 KB
testcase_15 AC 65 ms
71,456 KB
testcase_16 AC 68 ms
71,440 KB
testcase_17 AC 66 ms
71,400 KB
testcase_18 AC 68 ms
71,380 KB
testcase_19 AC 69 ms
71,484 KB
testcase_20 AC 70 ms
71,572 KB
testcase_21 AC 66 ms
71,416 KB
testcase_22 AC 65 ms
71,488 KB
testcase_23 AC 67 ms
71,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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