func mainB() {
    let S = readLine()!
    let T = readLine()!

    let Scount = S.count
    let Tcount = T.count

    var results: [Int] = []
    for i in 0..<Scount-Tcount {

        var count = 0
        for j in 0..<Tcount {
            let s = S[S.index(S.startIndex, offsetBy: i + j)]
            let t = T[T.index(T.startIndex, offsetBy: j)]
            if s == t {
                count += 1
            }
        }
        results.append(Tcount - count)
    }

    print(results.min()!)
}
mainB()