const processData = (lines) => {
    const S = lines[0]
    const T = lines[1]
    let min = T.length
    for (let i=0; i<S.length-T.length; i++) {
        let changes = T.length;
        for (let j=0; j<T.length; j++) {
            if (S[i+j] === T[j]) {
                changes--
            }
        }
        min = Math.min(min, changes)
    }

    console.log(min)
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    processData(lines)
})
