Append the remaining characters to the end of the result
while ( freq [ first ] > 0 ) { answer += ( String . fromCharCode ( first ) ) ; -- freq [ first ] ; } answer += ( A ) . join ( " " ) ; for ( let j = ' ' . charCodeAt ( 0 ) ; j <= ' ' . charCodeAt ( 0 ) ; j ++ )