s = gets.chomp.chars
t = gets.chomp.chars
ans = t.length

(s.length - t.length + 1).times {|n|
  sn = s[n .. (n + t.length - 1)]
  sum = 0
  t.length.times {|i|
    sn[i]
    t[i]
    if sn[i] != t[i]
      sum += 1
    else sum += 0
    end
    }
  if ans > sum
    ans = sum
  end
  }
p ans