#!/usr/bin/env ruby
# require 'pry'

# dpテンプレ

s = gets.chomp.split('')
t = gets.chomp.split('')

ans = 1000
(s.length-t.length + 1).times do |i|
  count = t.length
  t.length.times do |j|
    if s[i+j] == t[j]
      count -= 1
    end
    ans = [count, ans].min
  end
end

puts ans