Censor Dispenser Part Three

I’m having trouble with the third part of the censor dispenser challenge. Currently my code is functional, however it also censors the ‘her’ in researchers and will censor the ‘her’ in herself before the loop can censor the whole word.

The only solutions I could find through searching were to use Regex, but presumably this challenge doesn’t require that? Could someone help me to understand what I am missing?

My code is below. Thanks.