Generate Huffman codes for a given input.