Levenshtein distance between strings using dynamic programming