line = readlines
len = line.length
i = 0

while i < len
    line[i] = line[i].chomp
    i += 1
end

S = line[0]
T = line[1]

ls = S.length
lt = T.length

max_match = 0
for i in 1..(ls-lt+1) do
  match = 0
  for j in 1..lt do
    if S[i+j-2] == T[j-1] then
      match += 1
    end
  end
  if match > max_match then
    max_match = match
  end
end
puts lt - max_match