Looking for a better approach of the following question if possible.
Question: Let $A$ and $B$ be disjoint nonempty closed sets in a metric spaces $X$, and define $f(p)=\frac{\rho_A(p)}{\rho_A(p)+\rho_B(p)}$, $p\in X$ ($\rho $ is distance between point and set). Show that $f$ is continuous function on X whose range lies in $[0,1]$, $f(p)=0$ on $A$ and $f(p)=1$ on B.
Thought: Only continuity of $f$ is the non-trivial, we try to prove for given $\epsilon>0$ exist $\delta>0$ $d(p,q)<\delta$ implies $|f(p)-f(q)|<\epsilon$. To achieve the goal, try to find a small enough $\delta$ and points in set $A$ and $B$ that "estimate" distance (e.g. $d(a\in A,p)-\rho_A(p)$ small enough). However the inequality looks quite messy when I try to write down the rigorous proof.