program b177

implicit none
character(len=1000) :: s, t
integer(16) :: i, m, n, max, j, count

read *, s
read*,  t

do i = 1, 1000
 if(t(i:i) == ' ') then
  n = i - 1
  exit
 else
  n = 1000
 end if
end do

do i = 1, 1000
 if(s(i:i) == ' ') then
  m = i - 1
  exit
 else
  m = 1000
 end if
end do

max =  0
count = 0


do i = 1, m-n+1
 do j = 1, n
  if(s(i-1+j:i-1+j) == t(j:j)) then
   count = count + 1
  end if
 end do
 
 !print *, count
 
 if(count > max) then
  max = count
 end if
 
 count = 0
 
end do

print *, n - max


end program b177