Find and solve a recurrence relation for the number of words of length $n$ from letters $A, B, C,$ and $D$ which contain at least one $A$ and the first $A$ comes before the first $B$ (if there are any $B$s).
I can probably solve the recurrence relation, but I'm having a hard time coming up with relation to solve. I'm assuming that I need to look at where the first $A$ appears to get my equations.
Here are some thoughts.
A word of length $n$ that satisfies the criteria has $p$ $C$'s and $D$'s, where $0 \leq p < n$, followed by an $A$, followed by $q$ other letters (which can be any of $A,B,C,D$) where $q = n - p - 1$.
Given an example of a word of length $n$, you can construct a qualifying word of length $n+1$ by adding a $C$ or $D$ to the left side, or an $A,B,C,$ or $D$ to the right side.
Can you take it from here?