import re
frase=input('digite uma frase:')
palavraAntiga = input('digite uma palavra da frase:')
palavraNova = input('digite uma palavra nova pra substitui-la:')
novaFrase = re.sub(r"\b(" + palavraAntiga + r")\b(?!.*\b\1\b)", palavraNova, frase)
print(novaFrase)
aW1wb3J0IHJlCmZyYXNlPWlucHV0KCdkaWdpdGUgdW1hIGZyYXNlOicpCnBhbGF2cmFBbnRpZ2EgPSBpbnB1dCgnZGlnaXRlIHVtYSBwYWxhdnJhIGRhIGZyYXNlOicpCnBhbGF2cmFOb3ZhID0gaW5wdXQoJ2RpZ2l0ZSB1bWEgcGFsYXZyYSBub3ZhIHByYSBzdWJzdGl0dWktbGE6JykKbm92YUZyYXNlID0gcmUuc3ViKHIiXGIoIiArIHBhbGF2cmFBbnRpZ2EgKyByIilcYig/IS4qXGJcMVxiKSIsIHBhbGF2cmFOb3ZhLCBmcmFzZSkKcHJpbnQobm92YUZyYXNlKQ==