import kotlin.math.min

fun main() {
    val s = next()
    val t = next()
    println(res(s, t))
}

fun res(s: String, t: String): Int {
    var result = t.length
    for (i in 0..s.length-t.length) {
        val tmpStr = s.substring(i, t.length+i)
        var cnt = t.length
        for (j in tmpStr.indices) {
            if (t[j] == tmpStr[j]) cnt--
        }
        result = min(cnt, result)
    }
    return result
}


fun next() = readLine()!!