#include using namespace std; int main() { string N; cin >> N; int Max_number = 0; int N_N = N.size(); for (int i = 0; i < N_N; i++) { Max_number = max(Max_number, N[i] - '0'); } int swap_i = 0; for (int i = 0; i < N_N; i++) { if (N[i] != Max_number) { swap_i = i; break; } } for (int i = N_N - 1; i >= 0; i--) { if (N[i] - '0' == Max_number) { swap(N[swap_i], N[i]); cout << N; return 0; } } }