open Core;;

let s = In_channel.(input_line_exn stdin)
let t = In_channel.(input_line_exn stdin)

let () = 
  let res =
    let n = String.length s in
    let m = String.length t in
    let dist x y =
      let rec cnt i = if (i < 0) then 0 else (if (Char.equal (String.get x i) (String.get y i)) then 0 else 1) + cnt (i - 1) in
      cnt ((String.length x) - 1)
    in
    List.range 0 (n - m + 1) |>
    List.map ~f:(fun i -> dist (String.sub ~pos:i ~len:m s) t) |>
    List.reduce_exn ~f:Int.min
  in
  printf "%d\n" res
;;
