結果

問題 No.1617 Palindrome Removal
ユーザー convexineq
提出日時 2021-07-22 23:01:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 197 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 82,504 KB
実行使用メモリ 78,720 KB
最終ジャッジ日時 2024-07-17 19:36:33
合計ジャッジ時間 2,198 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
ans = 0
if s != s[::-1]:
    ans = len(s)
elif any(si != s[0] for si in s):
    if len(s) == 3:
        ans = -1
    else:
        ans = len(s)-2
elif len(s)%2:
    ans = -1
print(ans)
0