結果

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

ソースコード

diff #

S = input()
n = len(S)
if S != S[::-1]:
    print(n)
    exit()
if len(set(S)) == 1:
    if n%2:
        print(-1)
    else:
        print(0)
else:
    if n == 3:
        print(-1)
    else:
        print(n-2)
0