
object Main extends App {
  val S = io.StdIn.readLine
  val T = io.StdIn.readLine

  var min = Integer.MAX_VALUE
  (0 to (S.length - T.length)).foreach {i => 
    var count = 0
    (0 to T.length - 1).foreach {j =>
      if (S(i + j) != T(j)) {
        count += 1
      }
    }
    min = Math.min(min, count)
  }

  println(min)

}

