defmodule Main do
  def number(s1, s2, num) do
    Enum.map(0..(num-1), fn x -> if Enum.at(s1,x) == Enum.at(s2,x), do: 0, else: 1 end)
    |> Enum.sum()
  end

  def main() do
    s = IO.gets("") |> String.trim()
    t = IO.gets("") |> String.trim()

    num_s = String.length(s)
    num_t = String.length(t)

    if String.contains?(s, t) do
      IO.puts(0)
    else
      t = t |> String.splitter("", trim: true)
      0..(num_s - num_t)
      |> Stream.map(fn x ->
          String.slice(s, x, x+num_t-1)
          |> String.splitter("", trim: true)
          |> number(t, num_t)
        end)
      |> Enum.min()
      |> IO.puts()
    end
  end
end

