#include #define REP(i,n) for(int i=0,i##_len=(n);i>X; sort(All(X)); string ans="-1"; rep(i,1,X.size()){ if(X[i-1]!=X[i]){ swap(X[i-1],X[i]); reverse(All(X)); if(X[0]!='0') ans=X; break; } } cout<