fun main() {
  val s = readLine()!!
  val t = readLine()!!
  
  val sLen = s.length
  val tLen = t.length
  var ans = tLen
  for(i in 0 until sLen-tLen+1) {
    var count = 0
    for(j in 0 until tLen){
      if(s[i+j]!=t[j]) count++
    }
    if(ans>count) ans=count
  }
  println(ans)
}