import kotlin.math.min

fun main() {
    val S = readLine()!!
    val T = readLine()!!
    var min = 100000
    for (i in 0 until S.length - T.length+1) {
        var count = 0
        for (j in T.indices) {
            if (S.substring(i)[j] != T[j]) count++
        }
        min = min(min,count)
    }
    println(min)
}