結果

問題 No.1617 Palindrome Removal
ユーザー shotoyooshotoyoo
提出日時 2021-07-22 23:03:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 439 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 79,708 KB
最終ジャッジ日時 2023-09-24 18:54:05
合計ジャッジ時間 3,870 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
79,700 KB
testcase_01 AC 102 ms
79,708 KB
testcase_02 AC 95 ms
79,304 KB
testcase_03 AC 96 ms
79,276 KB
testcase_04 AC 86 ms
75,084 KB
testcase_05 AC 83 ms
74,088 KB
testcase_06 AC 86 ms
74,884 KB
testcase_07 AC 80 ms
73,484 KB
testcase_08 AC 72 ms
71,336 KB
testcase_09 AC 72 ms
71,484 KB
testcase_10 AC 84 ms
74,452 KB
testcase_11 AC 84 ms
74,256 KB
testcase_12 AC 86 ms
74,880 KB
testcase_13 AC 87 ms
74,884 KB
testcase_14 AC 72 ms
71,276 KB
testcase_15 AC 74 ms
71,252 KB
testcase_16 AC 73 ms
71,436 KB
testcase_17 AC 74 ms
71,360 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 73 ms
71,268 KB
testcase_21 AC 73 ms
71,272 KB
testcase_22 AC 73 ms
71,288 KB
testcase_23 AC 74 ms
71,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


s = input()
n = len(s)
if s==s[::-1]:
    if all((s[0]==s[i] for i in range(n))):
        if n%2==0:
            ans = 0
        else:
            ans = -1
    else:
        ans = n-2
else:
    ans = n
print(ans)
0