import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.min

object Solve {

  private val br = BufferedReader(InputStreamReader(System.`in`))
  private val out = PrintWriter(System.out)

  fun solve() {

    val s = br.readLine()!!
    val t = br.readLine()!!

    var ans = t.length

    for(shift in 0..(s.length-t.length)){
      var tmp = 0
      t.forEachIndexed{ idx, c ->
        if(c != s[idx+shift]) tmp++
      }
      ans = min(ans, tmp)
    }

    out.println(ans)
    out.flush()
  }
}

fun main(args: Array<String>) {
  Solve.solve()
}