import Enum

defmodule Main do
  def substring(str1,str2) do
    str2_len = String.length(str2)
    substrs = Enum.map(Enum.to_list(0..Enum.count(String.codepoints(str1))-1),fn x -> String.slice(str1,x,str2_len)end)
    commonstrs = Enum.map(substrs, fn x -> String.length(String.myers_difference(x,str2)[:eq]) end)
    str2_len - Enum.max(commonstrs)
  end

 def main do
    str1 = IO.read(:line) |> String.trim()
    str2 = IO.read(:line) |> String.trim()
    IO.inspect substring(str1,str2)
 end
end