I have a set of characters. They have spaces as well and these can move in between the characters. Say a set of characters are abc-- then the spaces can be moved as follow a-b-c. Keep in mind that the characters can never break their order that is for a set of characters abc-- can never be arranged as b-c-a but a-b-c is fine.
I want to calculate all the propability a set of characters and spaces can have.
Example
a b d - -
can be
a b d - -
a b - d -
a - b d -
- a b d -
- a b - d
- a - b d
- - a b d
a b - - d
a - - b d
a - b - d
If I am not wrong this example has 10 different probabilities.
I need a formula that can calculate the propability the spaces can move between characters without the characters breaking their order
i.e:
a b c d e - - - - -
a b c d -
Can you healp me ?
Suppose you have $n$ characters, and $m$ spaces. You are then counting solutions to $$a_0+a_1+\cdots +a_n=m$$ in nonnegative integers. $a_0$ represents the number of spaces following $0$ letters, $a_1$ represents the number of spaces following $1$ letter, etc.
This is counted with Multisets, specifically as $$\left(\!\!{n+1\choose m}\!\!\right)={m+n\choose m}=\frac{(m+n)!}{m!n!}$$
For the test case, $n=3, m=2$, giving $\frac{5!}{2!3!}=\frac{120}{2\cdot 6}=10$.