let input = require('fs').readFileSync('/dev/stdin', 'utf8')
// let input = require('fs').readFileSync('./sample_b.txt', 'utf8')
.split(/\n| /)
// .map(item => parseInt(item))
.slice(0,-1)

const [_A, _B] = input
const A = _A.split("")
const B = _B.split("")

let max = 0
for( let i=0; i<A.length-B.length+1; i++){
    let _max = 0
    for(let j=0; j< B.length; j++){
        if(A[i+j] === B[j]){
            _max++
        }
    }
    if(max < _max)max = _max
}

console.log(B.length - max)