locate first ' i ' from end such that bnum [ i ] == '0' and bnum [ i + 1 ] == '1' swap these value and break ;
if ( bnum . at ( i ) == '0' && bnum . at ( i + 1 ) == '1' ) { char ch = bnum . at ( i ) ; bnum . at ( i ) = bnum . at ( i + 1 ) ; bnum . at ( i + 1 ) = ch ; break ; } }