結果

問題 No.1617 Palindrome Removal
ユーザー 👑 H20H20
提出日時 2021-07-22 23:11:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 79,676 KB
最終ジャッジ日時 2023-09-24 19:12:40
合計ジャッジ時間 3,746 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
79,412 KB
testcase_01 AC 104 ms
79,676 KB
testcase_02 AC 96 ms
79,464 KB
testcase_03 AC 96 ms
79,464 KB
testcase_04 AC 87 ms
75,088 KB
testcase_05 AC 83 ms
74,304 KB
testcase_06 AC 85 ms
75,092 KB
testcase_07 AC 82 ms
73,564 KB
testcase_08 AC 75 ms
71,224 KB
testcase_09 AC 72 ms
70,940 KB
testcase_10 AC 85 ms
74,912 KB
testcase_11 AC 80 ms
74,092 KB
testcase_12 AC 85 ms
74,868 KB
testcase_13 AC 86 ms
75,028 KB
testcase_14 AC 71 ms
71,092 KB
testcase_15 AC 70 ms
71,312 KB
testcase_16 AC 72 ms
71,120 KB
testcase_17 AC 71 ms
71,368 KB
testcase_18 AC 73 ms
71,196 KB
testcase_19 AC 71 ms
71,316 KB
testcase_20 AC 72 ms
71,044 KB
testcase_21 AC 71 ms
71,288 KB
testcase_22 AC 72 ms
71,120 KB
testcase_23 AC 72 ms
71,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
if S!=S[::-1]:
    print(len(S))
    exit()

for i in range(len(S)-1):
    if S[i]!=S[i+1]:
        if len(S)==3:
            print(-1)
            exit()
        else:
            print(len(S)-2)
            exit()
if len(S)%2==1:
    print(-1)
else:
    print(0)
0