program main
  implicit none
  character(len=1000) :: S,T
  integer :: len_S, len_T
  !
  integer :: i, j
  integer,allocatable :: counter(:)
  read(*,*) S
  read(*,*) T
  len_S = len(trim(S))
  len_T = len(trim(T))

  allocate(counter(len_S-len_T))
  counter = 0
  do i = 1, len_S-len_T
     do j  = 0,len_T-1
        if (S(i+j:i+j) == T(j+1:j+1)) counter(i) = counter(i) + 1
     end do
  end do
  write(*,'(i0)') len_T- maxval(counter)
  stop
end program main
