removing the lexicographically smallest character from the string
for ( var i = 0 ; i < k ; i ++ ) { if ( s [ i ] === temp ) { s = s . substring ( 0 , i ) + s . substring ( i + 1 ) ; break ; } } } return X ; }