Given $a 、 b 、 c \geqslant 0, a+b+c=5$, let $S=2 a+2 a b+a b c$. Find the maximum value of $S$.

Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
Given the problem, we have
$$
\begin{aligned}
S & =2 a+2 a b+a b c \\
& =(5-b-c)(2+2 b+b c) \\
& =((5-b)-c)(2(1+b)+b c) \\
& =2(5-b)(1+b)+((5-b) b-2(1+b)) c-b c^{2} \\
& =2(5-b)(1+b)-(b-1)(b-2) c-b c^{2}
\end{aligned}
$$

When $1 < b < 2$, $3 < c < 4$,
$$
\begin{array}{l}
S=2(5-b)(1+b)-(b-1)(b-2) c-b c^{2} \\
<2(5-b)(1+b)-4(b-1)(b-2)-9 b^{5} \\
=-6 b^{2}+11 b+2 \\
=-6(b-1)^{2}-b+8<18
\end{array}
$$

When $b \geqslant 2$ or $0 \leqslant b \leqslant 1$,
$$
\begin{array}{l}
S=2(5-b)(1+b)-(b-1)(b-2) c-b c^{2} \\
\leqslant 2(5-b)(1+b) \\
\because 2\left(\frac{(5-b)+(1+b)}{2}\right)^{2}=18
\end{array}
$$

The equality holds when $5-b=1+b, c=0$, and $a+b+c=5$, i.e., when $a=3, b=2, c=0$, $S$ reaches its maximum value of 18.
Therefore, the maximum value of $S$ is 18.