How do I make this cell (lets say green) if these cells have the same word.

Hello, im pretty new with Libreoffice Calc, so i’d like some help
the problem I’m having is that I would like to do the following
If these two cells has this word, make this cell this colour.
for an example
A1 has the word aaa, and B1 also has aaa. I want to make C1 this colour (green).
But if A1 has the word aaa and B1 has bbb, I want to make C1 this colour (yellow).
And if A1 has the word bbb and B1 has bbb, I want to make C1 this colour (red)

Define a cell style for each colour you want use, then you can do what you want using conditional formatting applied on C1. The condition must be a formula.