s = gets.chomp.split('')
t = gets.chomp.split('')

ssize = s.size
tsize = t.size

ans = 1000

(ssize-tsize+1).times do |i|
  tmp = 0
  tsize.times do |u|
    if s[u+i] != t[u]
      tmp += 1
    end
  end
  ans = [ans,tmp].min
end
p ans
