(async () => {
    let input = '';
    for await (const chunk of process.stdin) input += chunk;
    const [s, t] = input.split(/\s/);

    if(s.includes(t)){
        console.log('0');
        return;
    }

    let lcs = 0;
    for (let i = 0; i < t.length; i++) {
        for (let j = i; j < s.length; j++) {
            if(t[i] === s[j]){
                let cs = 0;
                for (let k = 0; k < s.length - j && k < t.length - i; k++) {
                    if(t[i + k] === s[j + k]){
                        cs++;
                    }
                }
                if(cs > lcs){
                    lcs = cs;
                }
            }
        }
    }
    console.log(t.length - lcs);
})();