Inclusion - exclusion principle can be applied here.
So, Total words $= 3^5 - \binom{3}{1}*(3-1)^5 + \binom{3}{2}*(3-2)^5 = 243 - 3*32 + 3 = 150$
Another way of doing the same would be dividing the problem into two cases that : The $5-letter$ word will either contain $3$ copies of same letter and $1-1$ copy of other two letters (or) two copies of one letter, two of another, and one of the third letter.
Case 1: 5-letter word contains $3$ copies of same letter and $1-1$ copy of other two letters. One possible string here would be $\color{maroon}{aaabc}$. Total words possible $\color{navy}{ = \frac{5!}{3!}*3}$
Case 2: 5-letter word contains two copies of one letter, two of another, and one of the third letter. One such string would be $\color{maroon}{abacb}$ Total words possible $\color{navy}{ = \frac{5!}{2!2!}*3}$
So, total Words possible $\color{red}{ = \frac{5!}{3!}*3 + \frac{5!}{2!2!}*3 = 60 + 90 = 150}$