Find the number of rearrangements of the nine letters $\text{AAABBBCCC}$ where no three consecutive letters are the same. For example, count $\text{AABBCCABC}$ and $\text{ACABBCCAB}$ but not $\text{ABABCCCBA}.$

Let's think step by step and output the final answer within \boxed{}.
user