結果

問題 No.1617 Palindrome Removal
ユーザー gew1fw
提出日時 2025-06-12 15:52:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 279 bytes
コンパイル時間 397 ms
コンパイル使用メモリ 82,180 KB
実行使用メモリ 78,652 KB
最終ジャッジ日時 2025-06-12 15:52:16
合計ジャッジ時間 2,318 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 18 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input().strip()
n = len(S)

if S == S[::-1]:
    # Check if all characters are the same
    all_same = all(c == S[0] for c in S)
    if all_same:
        if n % 2 == 0:
            print(0)
        else:
            print(-1)
    else:
        print(n - 2)
else:
    print(n)
0