Find a recurrence relation for the number of ternary strings (0 s, 1 s and 2 s) of length n that contain none of the strings 101, 202, 102, or 201. What are the initial conditions? Use the recurrence to compute the number of such sequences of length 5.

I am trying this for the past 7 days. Please help me in solving this. help would be greatly appreciated.