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