#T48. 编辑距离

编辑距离

Description

Given two strings A and B, we need to convert string A into string B using the minimum number of character operations. The allowed character operations are as follows:

  1. Delete a character;
  2. Insert a character;
  3. Replace a character with another character.
    For any two strings A and B, calculate the minimum number of operations required to transform string A into string B.

Input Format

The first line contains string A; the second line contains string B. The lengths of both strings A and B are less than 2000.

Output Format

Output a single positive integer representing the minimum number of character operations required.

sfdqxbw
gfdgw


4