結果

問題 No.1617 Palindrome Removal
ユーザー neterukunneterukun
提出日時 2021-07-22 21:35:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 309 bytes
コンパイル時間 1,633 ms
コンパイル使用メモリ 86,804 KB
実行使用メモリ 94,764 KB
最終ジャッジ日時 2023-09-24 16:00:44
合計ジャッジ時間 5,107 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
94,328 KB
testcase_01 AC 113 ms
94,656 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 115 ms
94,552 KB
testcase_05 AC 94 ms
80,600 KB
testcase_06 AC 82 ms
75,080 KB
testcase_07 AC 78 ms
73,336 KB
testcase_08 AC 73 ms
70,968 KB
testcase_09 AC 73 ms
71,308 KB
testcase_10 AC 116 ms
93,996 KB
testcase_11 AC 97 ms
80,628 KB
testcase_12 AC 118 ms
94,764 KB
testcase_13 AC 116 ms
94,648 KB
testcase_14 AC 71 ms
71,412 KB
testcase_15 AC 72 ms
71,156 KB
testcase_16 AC 72 ms
71,012 KB
testcase_17 AC 72 ms
71,092 KB
testcase_18 AC 73 ms
71,292 KB
testcase_19 AC 72 ms
71,192 KB
testcase_20 AC 72 ms
71,224 KB
testcase_21 AC 72 ms
71,356 KB
testcase_22 AC 71 ms
71,324 KB
testcase_23 AC 72 ms
71,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
n = len(s)


a = s[0 : n // 2]
b = s[(n + 1) // 2 : n][::-1]

if a != b:
    print(n)
elif len(set(list(a))) != 1:
    if n == 1:
        print(-1)
    elif n == 2:
        print(2)
    elif n == 3:
        print(-1)
    else:
        print(n - 2)
elif n % 2 == 1:
    print(-1)
else:
    print(0)
0