結果

問題 No.1617 Palindrome Removal
ユーザー O2MTO2MT
提出日時 2021-07-23 17:25:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 128,028 KB
最終ジャッジ日時 2023-09-25 15:47:25
合計ジャッジ時間 5,248 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 194 ms
123,540 KB
testcase_01 AC 199 ms
126,264 KB
testcase_02 AC 197 ms
125,340 KB
testcase_03 AC 200 ms
124,952 KB
testcase_04 AC 204 ms
128,024 KB
testcase_05 AC 179 ms
117,536 KB
testcase_06 AC 203 ms
127,412 KB
testcase_07 AC 164 ms
106,852 KB
testcase_08 AC 94 ms
71,788 KB
testcase_09 AC 94 ms
71,764 KB
testcase_10 AC 200 ms
124,188 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 97 ms
71,452 KB
testcase_15 AC 96 ms
71,908 KB
testcase_16 AC 98 ms
71,908 KB
testcase_17 AC 97 ms
71,624 KB
testcase_18 AC 94 ms
71,780 KB
testcase_19 AC 97 ms
71,940 KB
testcase_20 AC 97 ms
71,624 KB
testcase_21 AC 97 ms
71,672 KB
testcase_22 AC 97 ms
71,716 KB
testcase_23 AC 96 ms
71,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

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