program B177
    implicit none
    character(1000) :: S, T
    character(1) :: js, jt
    integer(8) :: i, lenS, lenT, ans, j, k


    read(5,*) S
    read(5,*) T
    lenS = len_trim(S)
    lenT = len_trim(T)
    ans = lenT
    
    do i = 1, lenS-lenT+1
        k = 0
        do j = 1, lenT
            read(S(i+j-1:i+j-1),*) js
            read(T(j:j),*) jt
            if (js == jt) then
                k = k + 1
            end if
        end do

        if (ans > lenT-k) then
            ans = lenT - k
        end if
    end do

    write(6,*) ans
            




end program B177