#P2758. 编辑距离

编辑距离

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 types of operations:

  1. Delete one character.
  2. Insert one character.
  3. Replace one character with another.

Both AA and BB contain only lowercase letters.

Input Format

The first line contains string AA. The second line contains string BB. Both have length at most 20002000.

Output Format

Output a single positive integer, which is the minimum number of character operations.

sfdqxbw
gfdgw

4

Hint

For 100%100 \% of the testdata, 1A,B20001 \le |A|, |B| \le 2000.

Translated by ChatGPT 5