s = gets.chomp
t = gets.chomp

try_count = s.length - t.length

#puts "try_count: #{try_count}"
#puts "t_length: #{t.length}"
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
  # target.shift
  answer = diff if diff < answer
end

puts answer
