s = gets.chomp
t = gets.chomp

min_diff = 1 << 31
(0..(s.length - t.length)).each do |i|
  diff = 0
  (0...t.length).each do |j|
    diff += 1 if s[i + j] != t[j]
  end
  min_diff = diff if diff < min_diff
end
puts min_diff
