#t416. 编辑距离

编辑距离

Edit Distance

Problem Description

Let AA and BB be two strings. We want to transform string AA into string BB using the minimum number of character operations. There are three kinds of character operations:

  1. delete a character;
  2. insert a character;
  3. change one character into another.

Both AA and BB contain only lowercase letters.

Input Format

The first line is the string AA; the second line is the string BB. Both strings have length less than 20002000.

Output Format

A single positive integer: the minimum number of character operations.

Sample Input

sfdqxbw
gfdgw

Sample Output

4

Hint

For 100% of the test data, 1≤∣A∣,∣B∣≤20001 \le |A|, |B| \le 2000.