How many arrangements of red and blue balls are there so that, the number of red balls with: the ball immediately to the right is also red, is $9$. The question is too long to fit in the title, but I tried.
$50$ balls: $23$ indistinguishable red balls; $27$ indistinguishable blue balls. The balls are arranged in a line. How many distinct arrangements of the balls are there so that the following property holds:

The number of red balls such that the ball immediately to the right of it is also red, is $9.\quad (1)$

?
Can I please get my following solution verified. Also, feel free to post alternative solution of course.
Let the number of red balls with property $(1)$ be $k$. If we start by placing all $23$ red balls next to each other, then $k=22.\ $ Now between each red ball, we imagine there is a bin. We don't yet have a bin to the left of the first red or a bin to the right of the last red. There are $22$ bins between the first and last red ball. Each time you put a blue ball into one of these bins, you reduce the number $k$ by $1$. So what we can first do is find the number of distinct ways to put $(22-9=)\ 13$ blue balls into $22$ bins so that no two balls are in the same bin. This is just $\binom{22}{13}.$
Now we have placed $13$ blue marbles into bins such that no two blue marbles are in the same bin, and we did this so that $k=9$, and so property $(1)$ holds. We now have $27-13=14$ blue marbles remaining to put into bins. Ah, but not $22$ bins because that would ruin property $(1)$, and not just $13$ bins: the ones that we have just put the blue balls into, but...
Now we introduce a bin to the left of the first red and another bin to the right of the last red. We put the remaining $(27-13=)\ 14 $ blue balls into $(1+13+1=)\ 15$ bins! How many ways are there of doing this? Well, it is a classic stars and bars problem, in particular see Theorem 2 on wikipedia. The number of ways of putting the remaining $14$ blue balls into $15$ bins is $\binom{14+15-1}{14} =\binom{28}{14}.$
I believe all possible arrangements can be done like this, and there are no repeats in this method. Therefore the final answer is:
$$ \binom{22}{13} \times \binom{28}{14} = 497420 \times 40116600 = 19954799172000. $$
 A: To summarize the discussion in the comments:
Here is a somewhat different way to do the count which confirms your calculation.
We distinguish between two cases, according to whether the rightmost ball is red or blue.
Case I (rightmost ball blue).  As there are $23-9=14$ reds which are not to the immediate left of another red we must have $14$ blocks of the form $R^{a_i}B$ where $a_i≥1$ and $\sum a_i=23$.  There are $\binom {22}{13}$ ways to form those blocks.  There are then $13$ unassigned blues and $15$ bins in which to place them, so there are $\binom {13+15-1}{15-1}=\binom {27}{14}$ ways to place the blues.  Thus case I contributes $$\binom {22}{13}\times \binom {27}{14}$$
Case II:  (rightmost ball red.)  Now we have $13$ blocks of the form $R^{b_i}B$ and a final block of the form $R^{b_{14}}$.  As before there are $\binom {22}{13}$ ways to form those blocks.  Now we have $14$ unassigned blues and $14$ bins in which to place them, and there are $\binom {14+14-1}{14-1}=\binom {27}{13}$ ways to do that.  Thus case II contributes $$\binom {22}{13}\times \binom {27}{13}$$
Finally we add to get $$\binom {22}{13}\times \binom {27}{14}+\binom {22}{13}\times \binom {27}{13}=\binom {22}{13}\times \binom {28}{14}$$
which confirms your result.
