#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using Pll = pair; using Pii = pair; constexpr ll MOD = 1000000007; constexpr long double EPS = 1e-10; constexpr int dyx[4][2] = { { 0, 1}, {-1, 0}, {0,-1}, {1, 0} }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string s; cin >> s; int n = s.length(); vector v(n); for(int i=0;i 0 && v[i] == 0) --i; if(i == 0) { cout << -1 << endl; return 0; } for(;i>0;--i) { if(v[i-1] > v[i]) { swap(v[i-1], v[i]); swaped = true; break; } } if(!swaped) { cout << -1 << endl; } else { for(int i=0;i