def str_diff(str1, str2)
  str1.split('').zip(str2.split('')).inject(0) { |count, s| count += s[0] != s[1] ? 1 : 0 }
end

s = gets.strip
t = gets.strip
result = 10000 # greater than max length of s.

(s.length - t.length + 1).times do |start|
  result = [result, str_diff(t, s.slice(start, start+t.length-1))].min
end

p result
