Modified edit distance to account for substitutions