import kotlin.math.max

fun main(args: Array<String>) {
    val s = readString().reversed()
    val t = readString().reversed()

    var ans = 0
    for (i in 0..s.length - t.length) {
        var cnt = 0
        for (j in t.indices) {
            if (t[j] == s[i + j]) cnt++
        }
        ans = max(ans, cnt)
    }
    println(t.length - ans)
}

// read
fun readString() = readLine()!!