#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair; using namespace std; const int MOD = 1000000007; // 10^9 + 7 int main() { cin.tie(0); ios::sync_with_stdio(false); string n;cin >> n; int size = n.size(); int ans = stoi(n); for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { string m = n; char tmp = m[i]; m[i] = m[j]; m[j] = tmp; ans = max(ans, stoi(m)); } } cout << ans << endl; }