The Levenshtein distance (or edit distance) is a string metric for measuring the difference between two sequences. Formally, the Levenshtein distance between two strings is given by where:
where is the indicator function. It represents the minimum number of single-character edits required to change one sequence into the other.