結果

問題 No.927 Second Permutation
ユーザー もりを
提出日時 2019-11-22 21:23:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 178 bytes
コンパイル時間 744 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 63,360 KB
最終ジャッジ日時 2024-10-11 02:46:36
合計ジャッジ時間 3,358 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

s = list(input())
n = len(s)
if s == [s[0]] * n:
    print(-1)
    exit(0)
s = sorted(s)[::-1]
s[-1],s[-2] = s[-2],s[-1]
if s[0] == '0':
    print(-1)
else:
    print(''.join(s))
0