s = gets
t = gets

s_r = s.reverse
t_r = t.reverse

def ary_df(a,b)
  df = 0
  a.chars.each_with_index do |x, i|
    break unless b[i]
    if x != b[i]
      df += 1
    end
  end
  df
end
min = t_r.size
(1..s.size-1).each do |i|
  if t_r[0] == s_r[i]
    min_t = ary_df(t_r, s_r[i..-1])
    if min_t < min
      min = min_t
    end
  end
end

puts min