This is Question 19.8 of $Abstract\ Algebra:\ A\ First\ Course$ by Dan Saracino.
Let $\mathbb{F}$ be a fieald, $f(X) \in \mathbb{F}[X]$. If $a$ is a root of $f(X)$, then we can write $f(X)=(X-a)^mg(X)$, where $m \ge 1$ and $X-a$ does not divide $g(X)$. Show $m$ is uniquely determined by $f$ and $a$. That is if $f(X)=(X-a)^rh(X)$ and $X-a$ does not divide $h(X)$, then $m=r$.
Without loss of generality, I consider $r \ge m$. Then, $$(X-a)^m((X-a)^{r-m}h(X)-g(X))=0.$$ So $$\forall X\ne a,\ \ (X-a)^{r-m}h(X)=g(X).\ \ \ (1)$$
Now, one may say if $r>m$, then $X-a$ divides $g(X)$, which is a contradiction. Hence $r =m$. However, I think this argument does not work since (1) only works for $X \ne a$. Indeed, (1) does not imply $g(a)= 0$.
What should I do now to prove the statement?
In first equation
$$(X-a)^m((X-a)^{r-m}h(X)-g(X))=0.$$
is as element of polynomial ring $\mathbb{F}[X]$.
Now $\mathbb{F}[X]$ is integral domain and $X-a\neq 0$ as element of $\mathbb{F}[X]$, we get equation
$$ (X-a)^{r-m}h(X)=g(X).$$
as element of polynomial ring $\mathbb{F}[X]$.
There is difference the following tow condition for $p(X)\in \mathbb{F}[X]$.
(1) For all $a\in \mathbb{F}$, $p (a)=0$.
(2)$p(X)= 0\in \mathbb{F}[X]$.
In fact, for example $\mathbb{F}=\mathbb{F}_2$ and $p(X)=X^2+X$, then this satisfy (1) and not (2).