#C8508. Edit Distance

    ID: 52498 Type: Default 1000ms 256MiB

Edit Distance

Edit Distance

In this problem, you are given two strings. Your task is to compute the (\text{Levenshtein distance}) (also known as the edit distance) between the two strings. The Levenshtein distance is defined as the minimum number of single-character insertions, deletions, or substitutions required to transform one string into the other. For example, the distance between kitten and sitting is 3.

inputFormat

The input consists of exactly two lines. The first line contains the first string (s_1) and the second line contains the second string (s_2). The strings may be empty.

outputFormat

Output a single integer representing the Levenshtein distance between (s_1) and (s_2).## sample

kitten
sitting
3