var result = Int.max
let S = Array(readLine()!)
let T = Array(readLine()!)

for sIndex in 0..<S.count {
    if S.count - sIndex >= T.count {
        var tmpMin = 0
        for tIndex in 0..<T.count {
            if S[sIndex+tIndex] != T[tIndex] {
                tmpMin += 1
            }
        }
        result = min(result, tmpMin)
    }
}

print(result)
