#K64632. Minimum Edit Distance Transformation

    ID: 32019 Type: Default 1000ms 256MiB

Minimum Edit Distance Transformation

Minimum Edit Distance Transformation

Given two strings (S) and (T), you are to compute the minimum number of operations required to transform (S) into (T). The allowed operations are:

  1. Insertion: Insert any character at any position in (S).
  2. Deletion: Delete any character from (S).
  3. Substitution: Replace any single character in (S) with another character.

The solution involves dynamic programming where a table (dp[i][j]) represents the minimum edit distance between the first (i) characters of (S) and the first (j) characters of (T). Your answer should read input from standard input (stdin) and write the output to standard output (stdout).

inputFormat

The input consists of two lines. The first line contains the string (S) and the second line contains the string (T). Both strings can consist of any printable characters.

outputFormat

Output a single integer on one line: the minimum number of operations required to transform string (S) into string (T).## sample

abc
abc
0

</p>