Let's say we have a set of words of the same length, and we need to find the distance between words. In the case of binary words, one can use the Hamming distance. For example, if $a = 01101$ and $b = 00111$, then $d (a, b) = 2$. In my case, words are formed from the alphabet $\{a, b, c, d, e\}$, so the length of the alphabet is $5$, and the length of each word is $4$. In my case, an ordinal scale is applicable for letters, i.e. $$a <b <c <d <e.$$ Examples of words: `deed`, `aaaa`, `aaad`, `aaae`, `dada`, `cccd`. Edit. Hemming distance for three words `aaaa`, `aaad`, `aaae` gives $d(aaaa, aaad) = d(aaaa, aaae)$ but I am looking for a metric which will distinguish '$d$' and '$e$' and return $d(aaaa, aaad)<d(aaaa, aaae)$ because $d<e$. **Question.** What a metric can I use to calculate the distance between words?