# Hamming distance between sequences: hamdist

### 5.3.16 Hamming distance between sequences: hamdist

The hamdist command computes the Hamming distance between two sequences of equal lengths, which is defined to be the number of elements at same positions which do not match.

hamdist takes two arguments:

- s1, a vector or string.
- s2, a vector or string.

hamdist returns the number n of characters in s1 that are different than the corresponding characters in s2.

#### Example.

- Input:
  hamdist("cats","dogs")
- Output:

  3