Implemented the Levenshtein distance algorithm.