The edit distance between two strings is the minimum number of operations required to transform one string into the other.
The allowed operations are:
- Add one character to the string.
- Remove one character from the string.
- Replace one character in the string.
For example, the edit distance between LOVE and MOVIE is 2, because you can first replace L with M, and then add I.
Your task is to calculate the edit distance between two strings.
The first argument of input contains a string, A.
The second argument of input contains a string, B.
Return an integer, representing the minimum number of steps required.
- 1 <= length(A), length(B) <= 450
Input 1:
A = "abad"
B = "abac"
Output 1:
1
Explanation 1:
Operation 1: Replace d with c.