I am stuck at the following exercise:
Let $r, n \in \mathbb{N}$ and a let $\varphi : [n] \rightarrow [r]$ be a surjection. We say that $\varphi$ is even if $\left|\varphi^{-1}(i)\right|$ is even for all $i \in [r]$. Analogously, we call $\varphi$ odd if $\left|\varphi^{-1}(i)\right|$ is odd for all $i \in [r]$. Denote by $\mathcal{E}_n^{(r)}$ the class of all even surjections from $[n]$ to $[r]$ and analogously for $\mathcal{O}_n^{(r)}$. Consider the exponential generating functions $E(z)$ and $O(z)$ of
$$\mathcal{E} = \sum_{n \ge 1} \sum_{r \ge 1} \mathcal{E}_n^{(r)}$$
$$\mathcal{O} = \sum_{n \ge 1} \sum_{r \ge 1} \mathcal{O}_n^{(r)}$$
respectively. Derive closed expressions for $E(z)$ and $O(z)$.
In Analytic Combinatorics (4ed, p.108) by Flayolet and Sedgewick the authors prove the somehow similar statement that the EGF for all surjections is given by $\frac{1}{2-e^z}$, but I do not see how we could transfer this to here. Could you please help me?
Look back at how they derived the EGF for all surjections. They identified surjections with $\operatorname{Seq}(\operatorname{Set}_{\ge 1}( \mathcal{Z}))$. For example, $(\{2, 1\}, \{5\}, \{4, 6, 3\})$ would correspond to the function $f:[6] \to [3]$ given by $f(1)=f(2)=1$, $f(5)=2$, and $f(3)=f(4)=f(6)=3$. Following the constructions in Theorem II.1 for $\operatorname{Seq}$ and $\operatorname{Set}_{\ge 1}$ applied to the EGF $z$ for the atomic class $\mathcal{Z}$ yields $$\frac{1}{1-(e^z-1)} = \frac{1}{2-e^z}.$$
For even surjections, you just need to replace $\operatorname{Set}_{\ge 1}( \mathcal{Z})$ with $\operatorname{Set}_{\text{even}, \ge 2}( \mathcal{Z})$ which involves replacing $e^z-1$ with $\sum_{k \ge 2, \text{ even}} \frac{z^k}{k!} = \cosh z - 1$. Similarly, replacing $\operatorname{Set}_{\ge 1}( \mathcal{Z})$ with $\operatorname{Set}_{\text{odd}}( \mathcal{Z})$ involves replacing $e^z-1$ with $\sum_{k \text{ odd}} \frac{z^k}{k!} = \sinh z$.