program p2
    implicit none
    character(len=1005)::s, t
    integer::tmp, ans, i, j, ls, lt
    read(*,*) s, t
    ls = len_trim(s)
    lt = len_trim(t)
    ans = lt
    do i = 1, ls-lt+1
        tmp = 0
        do j = 1, lt
            if(s(i+j-1:i+j-1) .ne. t(j:j))  tmp = tmp + 1
        end do
        ans = min(tmp,ans)
    end do
    write(*,*) ans
    stop
end program