let s = readLine()!
let t = readLine()!
var answer = Int.max
for i in 0..<s.count-t.count+1 {
    var changeNeeded = 0
    for j in 0..<t.count {
        if s[s.index(s.startIndex, offsetBy: i+j)] != t[s.index(s.startIndex, offsetBy: j)] {
            changeNeeded += 1
        }
    }
    answer = min(answer, changeNeeded)
}
print(answer)
