fun solve(s:String, t:String){
    val ls = s.length
    val lt = t.length
    var ans = lt
    for(i in 0..(ls-lt)){
        var tmp = lt
        for(j in 0 until lt){
            if(s[i+j] == t[j]){
                tmp -= 1
            }
        }
        ans = Math.min(ans,tmp)
    }

    println(ans)

}

fun main(){
    val s = readLine()!!
    val t = readLine()!!
    solve(s,t)
}