program answer
  implicit none
  integer :: i, a, b, an, j, ans
  character(len=1000) :: S, T
  read(*,*) S
  read(*,*) T
  a=len_trim(S)
  b=len_trim(T)

  !do i = 1, a
   !  if(S(i:i+b-1)==T) then
    !    write(*,*) 0
    !    stop
    ! end if
  !end do

  ans=0
  do i = 1, a-b+1
     an=0
     do j = 0, b-1
        if(S(i+j:i+j)==T(j+1:j+1)) then
           an=an+1
        end if
     end do
     ans=max(ans,an)
  end do

  write(*,*) b-ans
  stop
 end program answer