S = $stdin.gets.chomp
T = $stdin.gets.chomp

def comp(a, b)
  cnt = a.length
  0.upto(a.length - 1) do |i|
    if a[i] == b[i]
      cnt -= 1
    end
  end
  return cnt
end

min = T.length
0.upto(S.length - T.length) do |start|
  ssub = S[start, T.length]
  min1 = comp(ssub, T)
  if min > min1
    min = min1
  end
end
puts min
