S = gets.chomp
T = gets.chomp

len_s = S.length
len_t = T.length

same = 0

0.upto(len_s - len_t){ |i|
  tmp_same = 0
  T.length.times{ |j|
    if S[i+j] == T[j]
      tmp_same += 1
    end
  }
  if tmp_same > same
    same = tmp_same
  end
}

puts (len_t - same)
