結果

問題 No.1617 Palindrome Removal
ユーザー wolgnikwolgnik
提出日時 2021-07-22 21:31:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 1,150 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 214,304 KB
最終ジャッジ日時 2023-09-24 15:52:35
合計ジャッジ時間 5,673 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
179,164 KB
testcase_01 AC 160 ms
188,188 KB
testcase_02 AC 204 ms
203,648 KB
testcase_03 AC 202 ms
202,920 KB
testcase_04 AC 212 ms
214,180 KB
testcase_05 AC 184 ms
185,772 KB
testcase_06 AC 167 ms
195,972 KB
testcase_07 AC 142 ms
156,036 KB
testcase_08 AC 71 ms
70,900 KB
testcase_09 AC 70 ms
71,112 KB
testcase_10 AC 198 ms
202,008 KB
testcase_11 AC 185 ms
186,232 KB
testcase_12 AC 211 ms
214,304 KB
testcase_13 AC 212 ms
214,288 KB
testcase_14 AC 70 ms
71,336 KB
testcase_15 AC 71 ms
71,112 KB
testcase_16 AC 70 ms
71,276 KB
testcase_17 AC 71 ms
71,336 KB
testcase_18 AC 70 ms
71,108 KB
testcase_19 AC 70 ms
71,248 KB
testcase_20 AC 72 ms
71,340 KB
testcase_21 AC 72 ms
71,388 KB
testcase_22 AC 72 ms
71,272 KB
testcase_23 AC 70 ms
71,296 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)

if len(S) != 3: print(len(S) - 2)
else: print(-1)
0