S = gets.chomp
T = gets.chomp

s_n = S.split("")
t_n = T.split("")
l = T.length
ans = l
t_n.each.with_index do |t, idx_t|
  s_n.filter_map.with_index{ |e, i| i if e == t}.each do |idx_s|
    next if idx_s + (l - idx_t) >= S.length
    next if idx_t > idx_s
    nomatch = idx_t
    (1...(l-idx_t)).each do |i|
      nomatch += 1 unless t_n[idx_t+i] == s_n[idx_s+i]
    end
    ans = [ans, nomatch].min
  end
end
p ans