Code to calculate the levenshtein distance