Let $W$ be the set of all possible permutations of $\texttt{X}, \texttt{X}, \texttt{X}, \texttt{Y}, \texttt{Y}, \texttt{Y}, \texttt{Z}, \texttt{Z}, \texttt{Z}$. Also, let $X$ (resp., $Y$) be the set of all words in $W$ that contains the substring $\texttt{XXX}$ (resp., $\texttt{YYY}$). We want to compute the number of elements of the set $W \setminus (X \cup Y)$. PIE tells that
$$ |W\setminus(X \cup Y)| = |W| - |X| - |Y| + |X \cap Y|, $$
so it suffices to compute $|W|$, $|X|$, $|Y|$, and $|X\cap Y|$. The key idea is that each of these numbers can be systematically computed using the permutations:
Clearly $|W| = \binom{9}{3,3,3} = 1680. $
Any word in $X$ can be obtained by treating the substring $\texttt{XXX}$ as a single symbol. Then $X$ is the set of all permutations of $\texttt{XXX}, \texttt{Y}, \texttt{Y}, \texttt{Y}, \texttt{Z}, \texttt{Z}, \texttt{Z}$, and so, $|X| = \binom{7}{1,3,3} = 140$. By the same reasoning, we also have $|Y| = \binom{7}{1,3,3} = 140$.
Any word in $X \cap Y$ can be obtained by treating each of $\texttt{XXX}$ and $\texttt{YYY}$ as a single symbol. Then $X$ is the set of all permutations of $\texttt{XXX}, \texttt{YYY}, \texttt{Z}, \texttt{Z}, \texttt{Z}$, so it follows that $|X \cap Y| = \binom{5}{1,1,3} = 20$.
Therefore,
\begin{align*}
|W\setminus(X \cup Y)|
= \binom{9}{3,3,3} - 2\binom{7}{1,3,3} + \binom{5}{1,1,3}
= \bbox[color:navy;padding:5px;border:1px navy dotted;]{1420}.
\end{align*}