program substring
    implicit none
    integer :: i, j, cnt, k, u, v
    character(1000) :: s, t
    read (*, *) s, t
    u = len_trim(s)
    v = len_trim(t)
    cnt = v
    do i = 1, u-v+1
        cnt = 0
        do j = 1, v
            if(s(j-i+1:j-i+1) .ne. t(j:j))then
                cnt = cnt + 1
            end if
        end do
        k = min(cnt, k)
    end do
    print *, k
end program