#include #include #include using namespace std; int main() { int N; cin >> N; string Ns = to_string(N); int maxdigit = 0; int maxidx = -1; for (int i = 0; i < (int)Ns.size(); ++i) { if (maxdigit <= Ns[i] - '0') { maxdigit = Ns[i] - '0'; maxidx = i; } } swap(Ns[0], Ns[maxidx]); cout << Ns << endl; }