import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto s = sread();
    auto t = sread();
    // writeln(s);
    long ans = long.max;
    foreach (i; 0 .. ((s.length - t.length) + 1))
    {
        // writeln(s[i .. (i + (t.length))]);
        ans = min(ans, func(s[i .. (i + (t.length))], t));

    }
    writeln(ans);
}

long func(string s, string t)
{
    long cnt;
    foreach (i; 0 .. s.length)
    {
        if (s[i] != t[i])
        {
            cnt += 1;
        }
    }
    return cnt;
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}
