Hamming distance is calculated by counting the number of bits that differ in the two given code words. It is calculated by doing the EXCLUSIVE OR operation on the bits of the code words. Hence, the two given code words are a hamming distance 5 apart.