Working version of hamming, using if/else and for loops