let s = readLine()!
let t = readLine()!

let sCount = s.count
let tCount = t.count

var answer = Int.max
var sIndex = s.startIndex
var tIndex = t.startIndex
var i = 0

while i < sCount-tCount+1 {
    var changeNeeded = 0
    var newSIndex = sIndex
    var newTIndex = tIndex
    var j = 0
    while j < tCount {
        if s[newSIndex] != t[newTIndex] {
            changeNeeded += 1
            if changeNeeded == answer {
                break
            }
        }
        j += 1
        newSIndex = s.index(after: newSIndex)
        newTIndex = t.index(after: newTIndex)
    }
    answer = min(answer, changeNeeded)
    i += 1
    sIndex = s.index(after: sIndex)
}
print(answer)
