結果
| 問題 | 
                            No.1617 Palindrome Removal
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-04-08 10:27:34 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 43 ms / 2,000 ms | 
| コード長 | 172 bytes | 
| コンパイル時間 | 674 ms | 
| コンパイル使用メモリ | 12,288 KB | 
| 実行使用メモリ | 13,068 KB | 
| 最終ジャッジ日時 | 2025-04-08 10:27:38 | 
| 合計ジャッジ時間 | 3,163 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 20 | 
ソースコード
s = input()
t = set(s)
if s != s[::-1]:
    print(len(s))
elif len(t) == 1:
    print(-1 if len(s) % 2 else 0)
elif len(s) == 3:
    print(-1)
else:
    print(len(s) - 2)