The goal is to build a frequency dictionary from given list of names with length <= 10^7 + 1.
However, i can\'t use naive approach, because i should not exceed mem