unittest
{
	assert( [ "cabacc", "abc" ].solve == 1 );
	assert( [ "codeforces", "atcoder" ].solve == 6 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	input.popFront;
	auto t = input.front.to!( dchar[] );
	
	auto ans = long.max;
	foreach( i; 0L .. s.length.signed - t.length.signed + 1 )
	{
		auto d = 0L;
		foreach( sc, tc; lockstep( s[ i .. i + t.length ], t ) )
		{
			d += ( sc != tc );
		}
		ans = min( ans, d );
	}
	return ans;
}
