import kotlin.math.min

fun main() {
    val s = readLn()
    val t = readLn()
    var ans = Int.MAX_VALUE
    for (i in s.indices) {
        if (i + t.length > s.length) break
        var change = 0
        for (j in t.indices) {
            if (s[i + j] != t[j]) change++
        }
        ans = min(ans, change)
    }
    println(ans)
}

// Input Reader
private fun readLn() = readLine()!!