#include #include #include using namespace std; using LL = long long; using ULL = unsigned long long; int main() { string N; cin >> N; int ans = stoi(N); const char *n = N.c_str(); 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, stoi(m)); } } cout << ans << endl; }