#include #include #include #include #include using namespace std; int keta(long long x){ int sum=0; while(x){ sum++; x/=10; } return sum; } int main() { string x; cin >> x; sort(x.begin(),x.end()); bool same=true; for(int i=0;i s; do{ s.push_back(atoi(x.c_str())); }while(next_permutation(x.begin(),x.end())); if(s.size()==1){ cout << -1 << endl; return 0; } if(keta(s[s.size()-2])