結果
| 問題 | 
                            No.1617 Palindrome Removal
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lam6er
                         | 
                    
| 提出日時 | 2025-04-15 23:55:11 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 312 bytes | 
| コンパイル時間 | 464 ms | 
| コンパイル使用メモリ | 81,720 KB | 
| 実行使用メモリ | 78,080 KB | 
| 最終ジャッジ日時 | 2025-04-15 23:56:40 | 
| 合計ジャッジ時間 | 2,452 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 18 WA * 2 | 
ソースコード
def is_palindrome(s):
    return s == s[::-1]
def all_same(s):
    return all(c == s[0] for c in s)
s = input().strip()
if not is_palindrome(s):
    print(len(s))
else:
    if all_same(s):
        if len(s) % 2 == 0:
            print(0)
        else:
            print(-1)
    else:
        print(len(s) - 2)
            
            
            
        
            
lam6er