program main
	character*3::s,t
    integer::ans=0
    integer i
    read *,s
    read *,t
    do i=1,3
    	if(s(i:i)==t(i:i)) then
        	ans=ans+1
        end if
    end do
    print '(i0)',ans
end program main