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

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

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)

fun main() {
    val S= readLine()!!
    val T= readLine()!!
    var ans=T.length

    for (i in 0 until S.length -T.length+1){
        var diff=0
        for (j in 0 until T.length){
            if (S[i+j]!=T[j]){
                diff++
            }
        }
        ans= min(ans,diff)
    }
    println(ans)
}