結果
| 問題 |
No.1617 Palindrome Removal
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-12 19:50:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 2,000 ms |
| コード長 | 357 bytes |
| コンパイル時間 | 3,590 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 76,672 KB |
| 最終ジャッジ日時 | 2025-01-12 19:50:38 |
| 合計ジャッジ時間 | 6,030 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
S = input().strip()
N = len(S)
flag = True
for i in range(N):
if S[i]!=S[N-1-i]:
flag = False
break
if not flag:
print(N)
else:
if N<=3:
print(-1)
else:
n = S.count(S[0])
if n==N and N%2==0:
print(0)
elif n==N and N%2==1:
print(-1)
else:
print(N-2)