提交时间:2025-03-09 15:17:16

运行 ID: 62139

#include <bits/stdc++.h> using namespace std; string fun(string s) { string x=s; prev_permutation(x.begin(), x.end()); if(x>s){ return "-1"; } else{ return x; } } int main() { string n; cin >> n;; cout<<fun(n); return 0; }