結果

問題 No.1617 Palindrome Removal
ユーザー wolgnikwolgnik
提出日時 2021-07-22 21:25:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 242 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 214,420 KB
最終ジャッジ日時 2023-09-24 15:30:53
合計ジャッジ時間 4,931 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 158 ms
179,188 KB
testcase_01 AC 163 ms
188,276 KB
testcase_02 AC 200 ms
203,640 KB
testcase_03 AC 201 ms
202,744 KB
testcase_04 AC 212 ms
214,384 KB
testcase_05 AC 187 ms
185,720 KB
testcase_06 AC 168 ms
195,856 KB
testcase_07 AC 145 ms
156,116 KB
testcase_08 AC 74 ms
71,100 KB
testcase_09 AC 76 ms
71,360 KB
testcase_10 AC 203 ms
201,896 KB
testcase_11 AC 189 ms
186,328 KB
testcase_12 AC 210 ms
214,288 KB
testcase_13 AC 213 ms
214,420 KB
testcase_14 AC 74 ms
71,384 KB
testcase_15 AC 74 ms
70,948 KB
testcase_16 AC 73 ms
71,108 KB
testcase_17 AC 73 ms
71,316 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 73 ms
71,312 KB
testcase_21 AC 74 ms
71,096 KB
testcase_22 AC 74 ms
70,940 KB
testcase_23 AC 73 ms
71,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
S = list(map(lambda x: ord(x) - ord("a"), list(input())[: -1]))

if len(set(S)) == 1:
  if len(S) % 2: print(-1)
  else: print(0)
  exit(0)

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

print(len(S) - 2)
0