結果

問題 No.1617 Palindrome Removal
ユーザー wolgnik
提出日時 2021-07-22 21:25:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 242 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 82,228 KB
実行使用メモリ 214,080 KB
最終ジャッジ日時 2024-07-17 16:16:56
合計ジャッジ時間 3,556 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 18 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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