Compute frequencies of all characters in the concatenated String .
let frequency = new Array ( 26 ) ; for ( let i = 0 ; i < 26 ; i ++ ) { frequency [ i ] = 0 ; } for ( let k = 0 ; k < concat . length ; k ++ ) { frequency [ concat [ k ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; }