#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) template inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } typedef long long ll; int const inf = 1<<29; int main() { string s; cin >> s; set st; st.insert(stoi(s)); rep(i, s.size()) REP(j, i+1, s.size()) { swap(s[i], s[j]); st.insert(stoi(s)); swap(s[i], s[j]); } cout << *st.rbegin() << endl; return 0; }