All of your pets should be on regular de worming treatment roughly every 3 months. To prevent this kind of thing from happening. Talk to your vet about drontal all wormer. Worming also goes hand in hand with flea treatment as fleas often carry tape worms eggs( which sounds like what your dog has)and carry from pet to pet. So all of your animals will need to be treated for both if your not already doing so. It may be gross but it is the pet Owners responsibility to prevent this from happening in the first place.