function to store frequency of each character in each string
function frequency ( fre , s , n ) { for ( let i = 0 ; i < n ; i ++ ) { let str = s [ i ] ; for ( let j = 0 ; j < str . length ; j ++ ) fre [ i ] [ str [ j ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; } }