Adding all words in map
for ( let i = 0 ; i < n ; i ++ ) { if ( mp . has ( dictionary [ i ] ) ) { mp . set ( dictionary [ i ] , mp . get ( dictionary [ i ] ) + 1 ) ; } else { mp . set ( dictionary [ i ] , 1 ) ; } }