ruby hamming distance solution