Calculating the Levenshtein Distance