import java.util.*
import kotlin.math.sin

fun main() {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val t = sc.next()
    val cnt = calc(s, t)
    println(t.length - cnt)
}

fun calc(s: String, t: String): Int {
    var oldCnt = 0
    var newCnt = 0
    s.forEachIndexed { index, c ->
        val index2 = getIndex(index, t.length)
        (0..index2).forEach { tindex ->
            val lastIndex = getLastIndex(s, t, index)
            newCnt = check(s, t, index, tindex, lastIndex)
            if (oldCnt < newCnt) {
                oldCnt = newCnt
            }
        }
    }
    if (oldCnt < newCnt) oldCnt = newCnt
    return oldCnt
}

fun check(s: String, t: String, index: Int, index2: Int, lastIndex: Int): Int {
    var sindex = index
    if (s.length - sindex - 1 < t.length - index2 - 1) return 0
    var cnt = 0
    (index2..lastIndex).forEach {
        if (sindex >= s.length) return cnt
        if (s[sindex] == t[it]) cnt += 1
        sindex++
    }
    return cnt
}

fun getIndex(index: Int, length: Int): Int {
    return if (index > length - 1) length - 1 else index
}

fun getLastIndex(s: String, t: String, sIndex: Int): Int {
    return t.length - 1
}