fun main(args: Array<String>) {
    val s = readLine()!!
    val t = readLine()!!
    var ans: Int = t.length
    
    for (start in 0..s.length - t.length) {
        var diff = 0
        for (i in 0 until t.length) {
            if (t.get(i) !== s.get(start + i)) {
                diff++
            }
        }
        ans = Math.min(ans, diff)
    }

    println(ans)

}