結果

問題 No.1617 Palindrome Removal
ユーザー neterukunneterukun
提出日時 2021-07-22 21:28:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 195 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 94,956 KB
最終ジャッジ日時 2023-09-24 15:37:19
合計ジャッジ時間 3,755 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
94,520 KB
testcase_01 AC 115 ms
94,752 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 116 ms
94,780 KB
testcase_05 AC 95 ms
80,532 KB
testcase_06 AC 83 ms
74,960 KB
testcase_07 AC 78 ms
73,456 KB
testcase_08 AC 71 ms
71,312 KB
testcase_09 AC 72 ms
71,512 KB
testcase_10 AC 117 ms
94,480 KB
testcase_11 AC 95 ms
80,764 KB
testcase_12 AC 116 ms
94,680 KB
testcase_13 AC 117 ms
94,956 KB
testcase_14 AC 74 ms
71,068 KB
testcase_15 AC 73 ms
71,444 KB
testcase_16 AC 72 ms
71,360 KB
testcase_17 AC 71 ms
71,220 KB
testcase_18 AC 72 ms
71,504 KB
testcase_19 AC 73 ms
71,036 KB
testcase_20 AC 72 ms
71,316 KB
testcase_21 AC 73 ms
71,368 KB
testcase_22 AC 73 ms
71,408 KB
testcase_23 AC 73 ms
71,344 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:
    print(n - 2)
elif n % 2 == 0:
    print(0)
else:
    print(-1)

0