open Printf
open Scanf

let num () = scanf "%d\n" (fun x -> x)
let num2 () = scanf "%d %d\n" (fun x y -> (x, y))
let num3 () = scanf "%d %d %d\n" (fun x y z -> (x, y, z))

let str () = scanf "%s\n" (fun s -> s)

let cmp s t =
  let m = String.length s in
  let n = String.length t in
  let count_diff i =
    let rec loop j c =
      if j=n then
        c
      else if s.[i+j] = t.[j] then
        loop (j+1) c
      else
        loop (j+1) (c+1)
    in loop 0 0
  in
  let rec loop i mc =
    if i > m - n then
      mc
    else
      let c = count_diff i in
      loop (i+1) (if mc < c then mc else c)
  in
  loop 0 m

let () =
  let s = str() in
  let t = str() in
  let c = cmp s t in
  printf "%d\n" c

