Fanatics search and catalog systems may need to compare product names that differ by typos or small edits. Given two strings, compute their Levenshtein distance, the minimum number of single-character insertions, deletions, or substitutions required to transform the first string into the second.
Each edit costs 1, matching characters costs 0, and the strings are case-sensitive.
Implement levenshtein_distance(word1, word2).
word1 and word2.def levenshtein_distance(word1, word2):