import java.util.Scanner
import java.lang.Math.*

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val s1 = scn.next()
	val s2 = scn.next()
	val dp = Array(s1.length+1){IntArray(s2.length+1)}
	for (i in 1..s1.length) dp[i][0] = i
	for (j in 1..s2.length) dp[0][j] = j

	for (i in 1..s1.length){
		for(j in 1..s2.length){
			dp[i][j] = dp[i-1][j-1]
			if (s1[i-1]!=s2[j-1]) dp[i][j]++
			dp[i][j] = min( dp[i][j], min(dp[i-1][j], dp[i][j-1])+1 )
		}
	}
	println(dp[s1.length][s2.length])
}
