import kotlin.math.max

fun main() {
    val s = readLine() ?: return
    val t = readLine() ?: return
    var c = 0
    0.until(s.length - t.length + 1).forEach { i ->
        var count = 0
        0.until(t.length).forEach { j ->
            if (s[i + j] == t[j]) {
                count++
            }
        }
        c = max(c, count)
    }
    println((t.length - c).toString())
}
