結果

問題 No.1617 Palindrome Removal
ユーザー lloyzlloyz
提出日時 2021-12-02 00:07:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 380 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 10,560 KB
実行使用メモリ 10,720 KB
最終ジャッジ日時 2023-09-18 10:05:05
合計ジャッジ時間 4,245 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
10,684 KB
testcase_01 AC 20 ms
10,020 KB
testcase_02 AC 19 ms
9,632 KB
testcase_03 AC 20 ms
10,720 KB
testcase_04 AC 21 ms
9,844 KB
testcase_05 AC 19 ms
10,220 KB
testcase_06 AC 20 ms
10,028 KB
testcase_07 AC 18 ms
9,200 KB
testcase_08 AC 16 ms
7,940 KB
testcase_09 AC 16 ms
7,904 KB
testcase_10 AC 20 ms
10,548 KB
testcase_11 AC 19 ms
9,432 KB
testcase_12 AC 21 ms
9,900 KB
testcase_13 AC 21 ms
9,888 KB
testcase_14 AC 15 ms
7,804 KB
testcase_15 AC 15 ms
7,952 KB
testcase_16 AC 15 ms
8,092 KB
testcase_17 AC 15 ms
7,916 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 15 ms
7,844 KB
testcase_21 AC 15 ms
7,872 KB
testcase_22 AC 15 ms
7,904 KB
testcase_23 AC 15 ms
7,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for alph in alphabets:
    if S == alph * n:
        if n % 2 == 1:
            print(-1)
        else:
            print(0)
        exit()

print(n - 2)

0