s = gets.chomp
t = gets.chomp

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.size
count = s.size-t.size
count = 1 if count.zero?

count.times do |i|
  min_t = ary_df(s[i..-1], t)
  min = min_t if min_t < min
end

puts min
