I sure second the notion that your reaction was far worse than the problem, and it will be impressive if she is able to shrug it off and grow up without shame and guilt about sexuality and have a normal attitude about it. See a therapist to figure out where *your* stuff came from, that was way over-the-top compared to the situation. When my husband was a little boy his mom and another mom found him and a little girl in bed, not doing much of anything but with their clothes off. The moms just picked them up and took them home. He laughs about it now; if his mom had acted like a sexually hung-up drama queen having a meltdown, who knows what conclusions he would have drawn and what shame he would have built into his mind about sex.
In your shoes, I might (if you can, now that all the bombs have been dropped), be wanting some day to find out what gave the kids the idea. That is a little unusual (the licking the pee-pee) for someone who has never even heard of the idea; she must have picked it up somewhere, such as a wrong channel on TV, another kid saying something, or even (we hope not) an adult exposing her to things beyond her years. But right now you really have to be very careful and gentle and backpedal on all the freaking out that you did, so she is not feeling horrible and ashamed.
Yelling, screaming and spanking is never going to solve the problem. It's not really even a problem. It just needs to be talked about in an unemotional way that makes your child feel safe and loved. In a way that teaches boundaries and helps her understand appropriate behavior. Children younger than them experiment. That's why we're here; to parent and guide them. If this is stressing you out so much that you can't have a conversation with your daughter about it, seek professional help for your family. A therapist will be able to guide you in how to talk to your daughter about this.