program sub_string
    implicit none
    character(len=1000) s
    character(len=1000) t
    integer a, b, n, i, j, con, ans
    integer,allocatable :: x(:)

    read *,s
    read *,t

    a=len_trim(s)
    b=len_trim(t)
    n=a-b
    i=0
    allocate(x(n+1))

    do while(i<=n)
        con=0
        do j=1,b
            if(s(j+i:j+i)/=t(j:j))then
                con=con+1
            end if
        end do
        i=i+1
        x(i)=con
    end do  
    ans=minval(x)
    print *,ans
end program sub_string