hamming greedy