Maximal substrings of even length

94 Views Asked by At

Say that a string of letter a, b and c is called special if all maximal substrings formed by consecutive letters b have even length, and if all maximal substrings formed by consecutive letters c have even length. For example, the strings abbcc or abbbbacc are special but the string ababcc is not.

Let $A_n$ be the number of special substrings of length n. Find the recursive formula $A_n$ in terms of $A_{n-1}$ and $A_{n-2}$.

1

There are 1 best solutions below

0
On BEST ANSWER

Hint:

Every special word ends with either at least one $a$, or ends with at least two $b$'s, or ends with at least two $c$'s.

and if you were to remove exactly one $a$ or remove exactly two $b$'s or exactly two $c$'s from the end, what remains is still a special word.