import Foundation

let s = readLine() ?? ""
let t = readLine() ?? ""

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

print(minCost)
