program abc48
 implicit none
 character(len=1000)::S,T
 integer::lengthS,lengthT,ia,ib
 integer,allocatable::a(:)
 read(*,*)S
 read(*,*)T
 lengthT=len_trim(T)
 lengthS=len_trim(S)
 allocate(a(lengthS-lengthT+1))
 a=0
 do ia=1,lengthS-lengthT+1
  do ib=0,lengthT-1
   if(S(ia+ib:ia+ib)==T(ib:ib))then
    a(ia)=a(ia)+1
   end if
  end do
 end do
 print'(i0)',lengthT-maxval(a)
end program abc48