結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 114 ms
94,672 KB
testcase_02 AC 112 ms
94,440 KB
testcase_03 AC 114 ms
94,464 KB
testcase_04 AC 116 ms
94,896 KB
testcase_05 AC 93 ms
80,632 KB
testcase_06 AC 81 ms
75,144 KB
testcase_07 AC 76 ms
73,364 KB
testcase_08 AC 74 ms
71,440 KB
testcase_09 AC 73 ms
71,048 KB
testcase_10 AC 114 ms
94,380 KB
testcase_11 AC 95 ms
80,360 KB
testcase_12 AC 118 ms
94,700 KB
testcase_13 AC 119 ms
94,908 KB
testcase_14 AC 71 ms
71,036 KB
testcase_15 AC 71 ms
71,392 KB
testcase_16 AC 72 ms
71,240 KB
testcase_17 AC 71 ms
71,368 KB
testcase_18 AC 73 ms
71,428 KB
testcase_19 AC 72 ms
71,440 KB
testcase_20 AC 72 ms
71,444 KB
testcase_21 AC 72 ms
71,172 KB
testcase_22 WA -
testcase_23 AC 73 ms
71,224 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 == 1:
    if n == 3:
        print(-1)
    else:
        print(n - 2)
else:
    print(0)
0