#include #define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false)) using namespace std; int main() { fastIO; string src; cin >> src; vector res; res.emplace_back(stoi(src)); for (size_t i = 0; i < src.size() - 1; ++i) { for (size_t j = i + 1; j < src.size(); ++j) { string copy = src; char temp = copy[i]; copy[i] = copy[j]; copy[j] = temp; res.emplace_back(stoi(copy)); } } sort(res.begin(), res.end()); cout << res.back() << '\n'; return 0; }