#include #include #include using namespace std; using LL = long long; using ULL = unsigned long long; int main() { string N; cin >> N; const char *n = N.c_str(); int ans = stoi(N); for (int i = 0; i < N.size() - 1; i++) { for (int j = i + 1; j < N.size(); j++) { char m[10]; memcpy(m, n, N.size()); char tmp = m[i]; m[i] = m[j]; m[j] = tmp; ans = max(ans, atoi(m)); } } cout << ans << endl; }