import scala.io.StdIn._

object Main extends App {

  val s = readLine()
  val t = readLine()
  def solve() = {
    val sLen = s.length
    val tLen = t.length
    val maxMatchCnt = (0 until sLen-tLen).foldLeft(0) { (maxMatchCnt, i) =>
      val tmpMatchCnt = (0 until tLen).foldLeft(0) { (matchCnt, j) =>
        if(s(j+i) == t(j)) matchCnt+1 else matchCnt
      }
      Math.max(tmpMatchCnt, maxMatchCnt)
    }
    tLen - maxMatchCnt
  }

  println(solve())

}

