結果

問題 No.1617 Palindrome Removal
ユーザー O2MTO2MT
提出日時 2021-07-23 17:17:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 308 bytes
コンパイル時間 1,669 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 127,396 KB
最終ジャッジ日時 2023-09-25 15:39:21
合計ジャッジ時間 5,977 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 187 ms
123,496 KB
testcase_01 AC 190 ms
126,368 KB
testcase_02 AC 190 ms
125,148 KB
testcase_03 AC 191 ms
125,100 KB
testcase_04 AC 198 ms
127,300 KB
testcase_05 AC 180 ms
117,388 KB
testcase_06 AC 203 ms
127,260 KB
testcase_07 AC 163 ms
106,648 KB
testcase_08 AC 89 ms
71,772 KB
testcase_09 AC 91 ms
71,500 KB
testcase_10 AC 199 ms
124,012 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 92 ms
71,780 KB
testcase_15 AC 91 ms
71,676 KB
testcase_16 AC 90 ms
71,720 KB
testcase_17 AC 90 ms
71,592 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 92 ms
71,484 KB
testcase_21 AC 91 ms
71,796 KB
testcase_22 AC 89 ms
71,396 KB
testcase_23 AC 92 ms
71,724 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(N-1)
    else:
      print(N-2)
0