if after maximizing the ranges any 1 is left then we maximize the String lexicographically .
if ( cc > 0 ) { for ( int i = 0 ; i < s . Length ; i ++ ) { if ( zz [ i ] == 0 ) { zz [ i ] = 1 ; cc -- ; } if ( cc == 0 ) break ; } } for ( int i = 0 ; i < s . Length ; i ++ ) Console . Write ( zz [ i ] ) ; Console . WriteLine ( ) ; }