program sample
	implicit none
    integer :: count,i
    character(len=3) :: a,b
    read(*,*) a,b
    
    do i=1,3
    	if (a(i:i)==b(i:i)) then
        	count = count+1
        end if
    end do
    write(*,*) count
    stop
end program sample

