s = gets.chomp
t = gets.chomp

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
def ary_eq(a,b)
  eq = 0
  a.chars.each_with_index do |x, i|
    break unless b[i]
    if x == b[i]
      eq += 1
    end
  end
  eq
end
min = t_r.size
(1..s.size-1).each do |i|
  if ary_eq(t_r, s_r[i..-1]) > 0 && t_r.size <= s_r[i..-1].size
    min_t = ary_df(t_r, s_r[i..-1])
    if min_t < min
      min = min_t
    end
  end
end

puts min
