hamming: First working solution