Help with Censor Dispenser Step 6

I am struggling with step 6 of Censor Dispenser:
So far my final function for email 4 looks like this, very different to what i have seen online and different from the codecademy solution, but makes sense to me. The only issue is when i am trying to censor the word before and after I am replacing every word of that type in the email and not limiting it to just before and after. Any ideas of the best way to solve it from where i am

 def censor_four(email, censor_lst,):
    for word in censor_lst:
        email = email.replace(word, "XXX")
    email_lst = email.split()
    for i in range(len(email_lst)):
        if email_lst[i] == "XXX":
            email = email.replace(email_lst[(i-1)], "XXX")
            email = email.replace(email_lst[(i+1)], "XXX")
    return email

censor_all = proprietary_terms + negative_words
print(censor_three(email_three, proprietary_terms, negative_words))

Thanks in advance, I think the solution somehow requires split but not sure how and where that would be implimented