結果

問題 No.1617 Palindrome Removal
ユーザー vltmttvltmtt
提出日時 2021-07-22 22:40:06
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 1,564 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 79,500 KB
最終ジャッジ日時 2023-09-24 18:05:16
合計ジャッジ時間 4,921 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
78,920 KB
testcase_01 AC 148 ms
78,900 KB
testcase_02 AC 156 ms
79,352 KB
testcase_03 AC 155 ms
79,352 KB
testcase_04 AC 157 ms
79,500 KB
testcase_05 AC 145 ms
79,272 KB
testcase_06 AC 155 ms
79,036 KB
testcase_07 AC 136 ms
78,116 KB
testcase_08 AC 93 ms
71,648 KB
testcase_09 AC 92 ms
71,524 KB
testcase_10 AC 154 ms
79,208 KB
testcase_11 AC 154 ms
79,156 KB
testcase_12 AC 167 ms
79,492 KB
testcase_13 AC 167 ms
79,444 KB
testcase_14 AC 93 ms
71,592 KB
testcase_15 AC 94 ms
71,768 KB
testcase_16 AC 92 ms
71,548 KB
testcase_17 AC 91 ms
71,904 KB
testcase_18 AC 91 ms
71,836 KB
testcase_19 AC 92 ms
71,804 KB
testcase_20 AC 96 ms
71,648 KB
testcase_21 AC 93 ms
71,744 KB
testcase_22 AC 96 ms
71,768 KB
testcase_23 AC 94 ms
71,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
x = input()
if len(x) >= 4:
    c = Counter(x)
    if len(c) == 1:
        print(-(len(x)%2))
    else:
        for i in range(len(x)//2):
            if x[i] != x[-i-1]:
                print(len(x))
                break
        else:
            print(len(x)-2)
else:
    if x[0] == x[-1]:
        print(-(len(x)%2))
    else:
        print(len(x))
0