4. Let the polynomial $p(x)=a x^{3}+b x^{2}+c x+d$, where $a, b, c, d$ are all constants. If dividing by $x^{2}+x+2$ leaves a remainder of $x+2$, and dividing by $x^{2}+x-2$ leaves a remainder of $3 x+4$. Find $a, b, c, d$. (1992 Taiwan, China Competition Question)
4. Given that there are constants $A, B$ and $C, D$, such that $p(x)=\left(x^{2}+x+2\right)(A x+B)+x+2=\left(x^{2}+x-2\right)(C x+D)+3 x+4$, we have $A x^{3}+(A+B) x^{2}+(2 A+B+1) x+2+2 B=C x^{3}+(C+D) x^{2}+(D-2 C+3) x+4-2 D$. Therefore, by $A=C, A+B=C+D, 2 A+B-1=B-2 A+3, 2+2 B=4-2 D$, we find $A=C=\frac{1}{2}, B=D=\frac{1}{2}$, so $p(x)=\frac{1}{2} x^{3}+x^{2}+\frac{5}{2} x+3$, hence $a=\frac{1}{2}, b=1, c=\frac{5}{2}, d=3$.