Edit Distance


You are given two strings aa and bb. In 1 operation you can do one of the following:

  • Remove a character from aa
  • Insert a character into aa
  • Replace a character in aa with another character.

What is the number of operations to turn the string aa into bb.

Input

The first line will contain the string aa. The second line will contain the string bb.

Output

Output the minimum number of operations to turn the string aa into bb.

Constraints

  • 1≤∣a∣,∣b∣≤1031 \le | a |, | b | \le 10^3

Example 1

Input 1
bbababbbab
ababbabbbb
Output 1
3

Example 2

Input 2
eadbeadcbc
bebbbceeca
Output 2
8

Example 3

Input 3
ebdccedbcbbdddcedeab
abdcbcaaeababddedbcd
Output 3
12

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.