object Main extends App {
  val s = io.StdIn.readLine
  val t = io.StdIn.readLine
  val n = t.length
  var mn = n
  for (idx <- 0 to s.length - n) {
    var tmp = 0
    for ((c1, c2) <- t.zip(s.substring(idx))) {
      if (c1 != c2) tmp += 1
    }
    mn = Math.min(mn, tmp)
  }
  println(mn)
}
