Finding a grammar for $L=\{a^nb^mc^rd^s| n+m<r+s\}$
Any word $w$ in $L$ can be split into two words $w$ and $w'$ such that $w \in \{a^n b^m c^r d^s \mid n + m = r+ s \}$, $w' \in \{c^r d^s \mid r+s &gt; 0\}$ and if the last symbol of $w$ exists and is $d$, then the first symbol of $w$ is $d$.
On the other hand, every choice of $w$ and $w'$ that satisfies the above constrains induces a word $w w' \in L$.
In the following grammar the first two productions take care of generating $w'$, while the other productions generate $w$. In particular the nonterminal $X_\alpha^\beta$ with $\alpha \in \{a,b\}$ and $\beta \in \{cd\}$ will generate all the words in $w \in \{a^n b^m c^r d^s \mid n + m = r+ s \}$ such that (i) if $\alpha=b$: then $n=0$ and (ii) if $\beta=c$ then $s=0$.
$$
\begin{align*}
S &amp;\to Sd \mid X_a^dd \mid Yc \mid X_a^cc \\
Y &amp;\to Yc \mid X_a^cc \\
X_a^d &amp;\to aX_a^d d \mid X_a^c \mid X_b^d \\
X_a^c &amp; \to aX_a^cc \mid X_b^c \\
X_b^d &amp;\to b X_b^d d \mid X_b^c \\
X_b^c &amp;\to bX_b^cc \mid \varepsilon
\end{align*}
$$