#include main(){ char S[10]; scanf("%s",S); for(int j = 0;j < strlen(S)-2;j++){ int max = S[j]-'0'; int index = j; for(int i = strlen(S)-1;i >= j+1;i--){ if(S[i]-'0' > max){ max = S[i] - '0'; index = i; } } if(S[j]-'0' < max){ char c = S[j]; S[j] = S[index]; S[index] = c; break; } } printf("%s",S); }