s = gets.chomp
t = gets.chomp

ans = 10 ** 20

m = s.size
n = t.size

(0..m-n+1).each do |i|
  tmp = 0
  (0..n-1).each do |j|
    if s[i..i+n-1][j] != t[j]
      tmp += 1
    end
  end
  ans = [ans, tmp].min
end
puts ans