hamming in ruby