Find the minimum number of single-character insertions, deletions or replacements that turn the first word into the second.
Input
Two lines, each a non-empty lowercase word of up to 500 characters.
Output
The minimum number of edits (the Levenshtein distance).
Hint
dp[i][j] is the distance between the first i characters of A and the first j of B. Matching characters cost nothing; otherwise take the cheapest of insert, delete and replace. One row at a time keeps memory at O(len(B)).
Read from standard input and write to standard output. 6 test cases in total (4 hidden). Tests for this language run inside your browser.