s = gets.chomp
t = gets.chomp

try_count = s.length - t.length
try_count += 1 if try_count == 0

answer = s.length 
try_count.times do |count|

  diff = 0
  t.length.times do |i|
    #puts "#{s[i+count]} #{t[i]}"
    if s[i+count] != t[i]
      diff += 1
    end
  end

  answer = diff if diff < answer
end

puts answer
