I am in interested into the following problem. We are given an alphabet $\Sigma$ of $k$ letters and a fixed string $S_1$ of length $l$ defined over $\Sigma$. Given a probability distribution $D$ over $\Sigma$, we sample another string $S_2$ from the set of possible strings defined over $\Sigma$ and with exactly length $n$. Each letter is $S_2$ is sampled independently. We consider that $S_1$ is a substring of $S_2$ if there exists two strings $p$ and $q$ such that: $S_2 = p S_1 q$. What is the probability that $S_1$ is a substring of $S_2$? Additional assumptions could be made about D.
For a uniform distribution, it is a combinatoric problem which solution has been studied for example in: https://stackoverflow.com/questions/6790620/probability-of-3-character-string-appearing-in-a-randomly-generated-password
Would you please have any insight about how it generalizes to any distribution of mean $\mu$ and standard deviation$D$ over $\sigma$$\Sigma$?