program prob78
    implicit none
    character(3) :: s,t
    integer :: i, c
    read(*,*) s,t
    c = 0
    do i = 1, 3
        if(s(i:i) == t(i:i)) then
            c = c + 1
        end if
    end do
    write(*,*) c

    stop
contains
end program prob78