[UCSD白板题] Compute the Edit Distance Between Two Strings

时间:2023-01-25 09:06:11

Problem Introduction

The edit distinct between two strings is the minimum number of insertions, deletions and mismatches in an alignment of two strings.

Problem Description

Task.The goal of this problem is to implement the algorithm for computing the edit distance between two strings.

Input Format.Each of the two lines of the input contains a string consisting of lower case latin letters.

Constraints.The length of both strings is at least 1 and at mot 100.

Output Format.Output the edit distance between the given two string.

Sample 1.
Input:

ab
ab

Output:

0

Sample 2
Input:

short
ports

Output:

3

Sample 3
Input:

editing
distance

Output:

5

Solution