S = gets.chomp.chars
T = gets.chomp.chars

def max(a, b) a > b ? a : b end

match = 0
0.upto(S.length - T.length) do |i|
  m = 0
  (T.length).times do |j|
    m += 1 if S[i+j] == T[j]
  end
  match = max(match, m)
end

print(T.length - match)