#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;c> s; sort(all(s)); reverse(all(s)); for(int i=s.size()-1;i>=0;i--){ if(s[i]!=s[s.size()-1]){ if(s[s.size()-1]=='0'&&i==0){ std::cout << -1 << '\n'; return 0; } swap(s[i], s[i+1]); std::cout << s << '\n'; return 0; } } std::cout << -1 << '\n'; return 0; }