If $R$ is a PID, $S$ an integral domain and $f: R \to S$ is an epimorphism, why is it that either $f$ is an isomorphism or $S$ is a field?
PID - Principal Ideal Domain
What I know:
If $S$ is not a field then we have to show that the function $f$ one to one since it's already an epimorphism (to show that $f$ is an isomorphism). If $f$ is not an isomorphism then we have to show that $S$ is a finite integral domain (= field).
However, I don't know how to use the facts If $R$ is a PID, $S$ an integral domain and $f: R \to S$ is an epimorphism, to prove the latter statement. Please I appreciate clear explanation. Thank you.