Calculate the number of different words, where $0$ appears an even number of times. Let the set of words with an even length $n$ from the alphabet: $\{ 0,1,2\}$.
Calculate the number of different words, where $0$ appears an even number of times.
For example, for $n=6$ , the words $121212,001212,000000$ are allowed,but the word $100011$ is not allowed.
My idea is:
$$\sum_{k=0}^{\frac{n-2}{2}} \binom{n}{2k} \cdot \binom{n-2k}{2}$$
Is this correct?

Another way is by using exponential generating function:
Since $0$ appears even number of times and $1,2$ has no restriction, the  egf is:
\begin{align*}
  G(x) &= \left(1+\frac{x^2}{2}+\frac{x^4}{4!}+\cdots\right)\left(1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\cdots\right)^2 \\
  &= \left(\frac{e^x+e^{-x}}{2}\right)e^{2x} \\
  &= \frac{e^{3x}+e^{x}}{2}
\end{align*}
and $$\left[\frac{x^n}{n!}\right]G(x) = \frac{3^n+1}{2}$$
