character(1000) :: s,t
integer :: sLen,tLen,i,j,mx=0,tempMx
read*,s
read*,t
sLen = len_trim( s )
tLen = len_trim( t )

do i = 0,sLen-tLen
  tempMx = 0
  do j = 1,tLen
    if( s(j:j)==t(j+i:j+1) ) tempMx = tempMx + 1
  end do
  mx = max( tempMx,mx )
end do
print*,tLen-mx
end
