first version of Levenshtein distance