結果

問題 No.1617 Palindrome Removal
ユーザー toyuzukotoyuzuko
提出日時 2021-08-15 00:52:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2024-04-15 22:46:06
合計ジャッジ時間 2,950 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
76,800 KB
testcase_01 AC 90 ms
76,928 KB
testcase_02 AC 82 ms
76,800 KB
testcase_03 AC 82 ms
76,672 KB
testcase_04 AC 80 ms
76,800 KB
testcase_05 AC 76 ms
76,544 KB
testcase_06 AC 48 ms
57,088 KB
testcase_07 AC 47 ms
55,040 KB
testcase_08 AC 42 ms
51,968 KB
testcase_09 AC 41 ms
51,584 KB
testcase_10 AC 74 ms
76,928 KB
testcase_11 AC 71 ms
76,672 KB
testcase_12 AC 75 ms
76,928 KB
testcase_13 AC 75 ms
77,056 KB
testcase_14 AC 41 ms
51,968 KB
testcase_15 AC 41 ms
51,584 KB
testcase_16 AC 40 ms
51,712 KB
testcase_17 AC 41 ms
51,712 KB
testcase_18 AC 41 ms
51,584 KB
testcase_19 AC 41 ms
51,712 KB
testcase_20 AC 41 ms
51,584 KB
testcase_21 AC 42 ms
51,968 KB
testcase_22 AC 43 ms
51,584 KB
testcase_23 AC 41 ms
51,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
L = len(S)

for i in range(L):
    if S[i] != S[~i]:
        print(L)
        break

else:
    for i in range(L - 1):
        if S[i] != S[i + 1]:
            if L == 3:
                print(-1)
            else:
                print(L - 2)
            break

    else:
        if L % 2 == 0:
            print(0)
        else:
            print(-1)
0