import java.util.*
fun main(args: Array<String>) {
    val reader = Scanner(System.`in`)

    val S = reader.next()
    val T = reader.next()
    var matchMax = 0

    var checkIndex = 0
    while(checkIndex <= S.length - T.length){
        var curMatch = 0
        for(count in checkIndex..checkIndex + T.length - 1){
            if(T[count - checkIndex] == S[count]){
                curMatch++
            }
        }
        if(curMatch > matchMax){
            matchMax = curMatch
        }
        checkIndex++
    }
    println(T.length - matchMax)
}