Problem
Return the fewest single-character edits needed to change the string before into the string after.
One edit may insert a character, delete a character, or replace one character with another. Each such edit counts as one operation.
Examples
Example 1
Input: before = "plane", after = "plans"
Output: 1
Replacing the final e with s completes the change in one edit.
Example 2
Input: before = "", after = "moss"
Output: 4
Starting from an empty string requires inserting its four characters.
Constraints
-
0 <= before.length <= 500
-
0 <= after.length <= 500
-
Both strings contain lowercase English letters only.