#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int f(string s) { int ret = 0, dec = 1; for(int i = s.size() - 1; 0 <= i; i--) { ret += (int)(s[i] - '0') * dec; dec *= 10; } return ret; } int main() { string N; cin >> N; int ans = f(N); for (int i = 0; i < N.size() - 1; i++) { for (int j = i + 1; j < N.size(); j++) { string ts = N; char t; t = ts[i]; ts[i] = ts[j]; ts[j] = t; ans = max(ans, f(ts)); } } cout << ans << endl; return 0; }