#include using namespace std; int main() { int i; int iPos; int iPos2; char S[ 12 ]; char C; char cMax; cin >> S; cMax = '0'; i = 0; iPos = 0; while( ( C = S[ i ] ) != 0 ) { if( cMax <= C ) { iPos = i; cMax = C; } i++; } for( i = 0; i < iPos; i++ ) { if( cMax > S[ i ] ) { swap( S[ i ], S[ iPos ] ); break; } } cout << S << endl; return 0; }