import Foundation

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

let minCost = (0...s.count - t.count).lazy
    .map(s.dropFirst)
    .map { zip($0, t).lazy.filter { $0 != $1 }.count }
    .min() ?? 0

print(minCost)
