How many strings of length $10$ exist? For each position in the string we have $5$ choices That's $5^{10}$
How many strings of length $10$ with no $A$'s exist? For each position in the string we have $4$ choices That's $4^{10}$
How many strings of length $10$ with no $B$'s exist? For each position in the string we have 4 choices That's $4^{10}$
How many strings of length $10$ with no $A$'s and no $B$'s exist? For each position in the string we have $3$ choices That's $3^{10}$
Now we need to subtract the number of "no $A$ no $B$" strings from the number of "no $A$" strings to get the number of "no $A$ and at least $1$ $B$" strings $4^{10} - 3^{10}$
And we need to subtract the number of "no $A$ no $B$" strings from the number of "no $B$" strings to get the number of "no $B$ and at least $1$ $A$" strings $4^{10} - 3^{10}$
Now we need to subtract the number of "no $A$ and no $B$" strings and the number of "no $A$ and at least $1$ $B$" strings and the number of "no $B$ and at least $1$ $A$ strings" from the total number of length $10$ strings
So the answer is : $$5^{10} - (4^{10} - 3^{10}) - (4^{10} - 3^{10}) - (3^{10})$$ or $$5^{10} - 4^{10} - 4^{10} + 3^{10} + 3^{10} - 3^{10}$$
so $$5^{10} - 2 * 4^{10} + 3^{10}$$