#include #include #include #include #include #include #include #include #include // require sort next_permutation count __gcd reverse etc. #include // require abs exit atof atoi #include // require scanf printf #include #include // require accumulate #include // require fabs #include #include #include #include // require setw #include // require stringstream #include // require memset #include // require tolower, toupper #include // require freopen #include // require srand #define rep(i,n) for(int i=0;i<(n);i++) #define ALL(A) A.begin(), A.end() using namespace std; typedef long long ll; typedef pair P; ll s2ll (string s ){ stringstream ss (s ); ll res; ss >> res; return res; } int main() { ios_base::sync_with_stdio(0); string N; cin >> N; int n = N.length(); ll res = s2ll (N ); rep (i, n ){ for (int j = i+1; j < n; j++ ){ string curr = N; swap (curr[i], curr[j] ); // cerr << "curr: " << curr << endl; res = max (res, s2ll (curr ) ); } // end for } // end rep cout << res << endl; return 0; }