#include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i, n) for(int (i) = (0); (i) < (n); (i++)) using ll = long long; int main() { string n; cin >> n; ll ans = stoll(n); string s = n; for(int i = 0; i < s.size(); ++i){ for(int j = i; j < s.size(); ++j){ swap(s[i], s[j]); ll tmp = stoll(s); ans = max(ans, tmp); s = n; } } cout << ans << endl; }