#include using namespace std; int main () { string str; cin >> str; char a = '9' + 1 , b = '0' - 1; int memo , memo2; for( int i = 0; i < str.size (); i++ ) { char x = str[i]; if( b <= x ) { b = x; memo2 = i; } } memo = memo2; for( size_t i = 0; i < memo2; i++ ) { if( str[i] < b ) { memo = i; break; } } swap ( str[memo] , str[memo2] ); cout << str << endl; return 0; }