string = gets.strip
text = gets.strip

max_pos = 0
string.size.times.each do |num|
  count = 0
  substr = string[num...(num + text.size)]
  # p substr
  substr.size.times.each do |i|
    count += 1 if substr[i] == text[i]
  end
  max_pos = [max_pos, count].max
end
puts text.size - max_pos