#!/usr/bin/env ruby

S = gets.chomp
T = gets.chomp

N = S.length - T.length + 1

max = 0

N.times do |i|
  matches = 0

  T.length.times do |j|
    matches += 1 if S[i + j] == T[j]
  end

  max = matches if max < matches
end

puts T.length - max
