s = gets.strip
t = gets.strip
result = t.length

0.upto(s.length - t.length).times do |start|
  c = 0
  t.length.times do |i|
    c += 1 if t[i] != s[start+i]
  end
  result = [c, result].min
end

p result
