compute the Hamming distance between two strings
HammingDistance( s, t )
The HammingDistance(s,t) command returns an integer measure of the distance between the two strings s and t.
The Hamming distance between two strings s and t, of equal length, is the number of character positions where they differ. If strings s and t have respective lengths m and n where, without loss of generality, n<m, then the generalized Hamming distance between s and t is defined to be (m - n) + HammingDistance( s[ 1 .. n ], t ). The HammingDistance procedure computes this generalized metric.
For a different notion of the distance between two strings, see StringTools[Levenshtein].
Since it is a metric, the Hamming distance satisfies the triangle inequality.
s ≔ Random⁡1000,'lower':
t ≔ Random⁡1000,'lower':
u ≔ Random⁡1000,'lower':
Download Help Document
What kind of issue would you like to report? (Optional)
Thank you for submitting feedback on this help document. Your feedback will be used
to improve Maple's help in the future.