hamming 2nd iteration