You are given a string of $10$ characters, that can either be 'A' or 'B'. How many of them do not contain the string 'ABA'?
What I thought was to adopt a recursive approach. Supposing we know the number $n_7$ of strings of $7$ characters that don't contain 'ABA', then we have a choice of 8 places to put that string in, so there will be $2^{10}-(8 \cdot n_7)$ strings that satisfy the request. Similarly, we can find that $n_7$ is equal to $2^7-(5 \cdot n_4)$, and that $n_4=2^4-(2 \cdot n_1)$.
Since $n_1$ is obviously equal to $2$, we can subsitute that in and get
$n_4=2^4-4=12$
$n_7=2^7-60=68$
$n_{10}=2^{10}-544=480$
Is my reasoning correct?