Probability that "abcdef" appears without "abcd" and "cdef" Suppose there is a random character generator which generates each character (from "a" to "z") with equal probability $\frac{1}{26}$. We generate characters and concatenate them to form a string until we see "abcdef" at the end. I'd like to ask how to calculate the probability that "abcd" and "cdef" do not appear before the suffix "abcdef"?
For example, "xyzcdeababcdef" satisfies the requirement but "cd$\color{red}{abcd}$eabcdef" does not.
An extension is that all characters are generated with different (possibly unequal) possibilities. How can we tackle this?
 A: The following answer is based upon the Goulden-Jackson Cluster Method. We consider the set of words of length $n\geq 0$ built from an alphabet $$\mathcal{V}=\{a,\ldots,z\}$$ and the set $B=\{abcd,cdef\}$ of bad words, which are not allowed to be part of the words we are looking for. We derive a generating function $f(s)$ with the coefficient of $s^n$ being  the number of wanted words of length $n$.
According to the paper (p.7) the generating function $f(s)$  is
\begin{align*}
f(s)=\frac{1}{1-ds-\text{weight}(\mathcal{C})}\tag{1}
\end{align*}
with $d=|\mathcal{V}|=26$, the size of the alphabet and $\mathcal{C}$ is the weight-numerator of bad words with
\begin{align*}
\text{weight}(\mathcal{C})=\text{weight}(\mathcal{C}[abcd])+\text{weight}(\mathcal{C}[cdef])\tag{2}
\end{align*}

We calculate according to the paper
  \begin{align*}
\text{weight}(\mathcal{C}[abcd])&=-s^4\\
\text{weight}(\mathcal{C}[cdef])&=-s^4-s^2\text{weight}(\mathcal{C}[abcd])\tag{3}\\
\end{align*}
  so  that
  \begin{align*}
\text{weight}(\mathcal{C})=-s^4+\left(-s^4-s^2\cdot\left(-s^4\right)\right)=-2s^4+s^6
\end{align*}
  The additional term on the right-hand side of (3) takes account of the overlapping of $ab\color{blue}{cd}$ with $\color{blue}{cd}ef$.
We obtain according to (1) and (3)
  \begin{align*}
f(s)&=\frac{1}{1-ds-\text{weight}(\mathcal{C})}\\
&=\frac{1}{1-26s+2s^2-s^6}\\
&=1 + 26 s + 676 s^2 + 17\,576 s^3 + 456\,974 s^4\\
&\qquad  + 11\,881\,272 s^5 + \color{blue}{308\,911\,721} s^6 + 8\,031\,669\,620 s^7 + \cdots
\end{align*}
  where the last line was calculated with the help of Wolfram Alpha. 

Example: The blue marked coefficient of $s^{6}$  shows there are $\color{blue}{308\,911\,721}$ words of length $6$ over the alphabet $\mathcal{V}$ which do not contain $abcd$ or $cdef$. It follows the probability of words of length $6$ which do not contain $abcd$ or $cdef$ is
\begin{align*}
\frac{308\,911\,721}{26^6}
\end{align*}
and since we are looking for words with suffix $abcdef$ we conclude the probability of words of length $12$ with suffix $abcdef$ containing neither substrings $abcd$ nor $cdef$ before the suffix is
\begin{align*}
\frac{308\,911\,721}{26^{12}}\doteq3.237\cdot 10^{-9}
\end{align*}

According to OPs comment: In order to calculate the overall probability
  \begin{align*}
\sum_{n=0}^\infty \frac{a_n}{26^{6+n}}
\end{align*}
  where $f(s)=\sum_{n=0}^\infty a_ns^n$, we obtain
  \begin{align*}
\color{blue}{\frac{1}{26^6}\sum_{n=0}^\infty  \frac{a_n}{26^n}}&=\left.\frac{1}{26^6}f\left(\frac{s}{26}\right)\right|_{s=1}\\
&=\left.\frac{1}{26^6}\cdot\frac{1}{1-s+2\left(\frac{s}{26}\right)^2-\left(\frac{s}{26}\right)^6}\right|_{s=1}\\
&=\frac{1}{2\cdot 26^4-1}\\
&\,\,\color{blue}{=\frac{1}{913\,951}\doteq 1,0.94\cdot 10^{-6}}
\end{align*}

