Skip to main content
1 of 2

How many words are there such that some word $X$ is subsequence of them?

Let's define subsequence of the word as part of this word created by deleting some of its letters, for example aetics is a subsequence of mathematics. Given $3$ letter word (let's call it $X$) I want to know how many words consisting of exactly $k_A$ letters $a$, $k_B$ letters $b$, ..., $k_Z$ letters $z$ are there such that $X$ is subsequence of it. For example, if $k_A = 1, k_B = 1, k_C = 1, k_D = 1, k_E = 0, ..., k_z = 0$, and $X = abc$, then there are $4$ such words.