I'm uncomfortable with saying to women that if you're confident it won't happen. Because I'm confident and it still DOES happen. If anything it happens more.
At school, I used to get boys trying to grope me constantly, in my early teens older teens, sometimes in cars would follow me home, despite the fact I was dressed in school uniform and was clearly a child. I was confident, would face them down, tell them they were pathetic, and to get lost.
And they did it all the more, because they liked getting a reaction. The girls who didn't react got a tiny proportion of the grief I did.
There are a lot of men who still behave in this unpleasant, entitled way. They will give grief to anyone (I've seen men shouting disgusting abuse at policewomen for example). Confidence doesn't matter to them. Your reaction doesn't matter indeed if you do react, they often do it all the more. And of course as I mentioned upthread, you run the risk of being physically attacked and/or threatened with violence, because these men see women as nothing more than pieces of meat, as nothing. So they'd be quite happy to punch you in the face if you get too gobby with them.
If this abuse happens, it is no-ones fault bar the mans. If you are confident and assertive, it might mean you get less hassle. But it might not.
The responsiblity for stopping this shit lies with the men who do it. We should not have to tailor our lives, our personalities to in some way make ourselves less vulnerable to attack. We should be able to dress as we want, be as we want. Men don't have to modify or change their appearance or behaviour, why should we?