S = gets.chomp.split('')
T = gets.chomp.split('')

# puts S.length - T.length

m = 10000
(S.length - T.length + 1).times do |f|
  c = 0
  T.length.times do |i|
    c+= 1 if T[i] != S[i+f]
  end
  m = c if c < m
end
puts m
