S = gets.chomp.split("").map(&:to_s)
T = gets.chomp.split("").map(&:to_s)
ans = T.length

(0..S.length-T.length).each do |i|
num = 0
x = 0

(i..i+T.length-1).each do |n|
  if S[n] != T[x]
      num += 1
  end
  x += 1
end

if num < ans
  ans = num
end
end

puts ans