結果

問題 No.1617 Palindrome Removal
コンテスト
ユーザー O2MT
提出日時 2021-07-23 17:09:39
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 230 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,940 ms
コンパイル使用メモリ 95,728 KB
実行使用メモリ 133,704 KB
最終ジャッジ日時 2026-08-17 02:46:32
合計ジャッジ時間 6,460 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import Counter

S = str(input())
N = len(S)
if len(S) == 1:
  print(-1)
  exit()
ls = list(S)
cs = Counter(ls)
if len(cs) == 1:
  print(0)
else:
  if S[:N//2] != S[N-1:N//2:-1]:
    print(N)
  else:
    print(N-2)
0