TITLE: Self-maps of the Cantor set
QUESTION [7 upvotes]: Let $X$ and $Y$ be homeomorphic to the Cantor set and pick $x_0\in X$.
Suppose $f\colon X\to Y$ is a continuous function such that $f\upharpoonright X\setminus\{x_0\}$ is injective. Must $f$ be injective? Well, $X$ is disconnected so we can't apply the Darboux property directly.

REPLY [3 votes]: It is possible to have a non-injective $f$. Let $C$ be the middle-thirds Cantor set, and let
$$f:C\to[0,1]:x\mapsto\begin{cases}
\frac32x,&\text{if }0\le x\le\frac13\\\\
\frac32x-\frac12,&\text{if }\frac23\le x\le 1\;.
\end{cases}$$
Let $Y=f[C]$; then $Y$ is a Cantor set, $f$ is injective on $C\setminus\left\{\frac13\right\}$, and $f\left(\frac23\right)=f\left(\frac13\right)=\frac12$.
Intuitively, I simply stretched $C\cap\left[0,\frac13\right]$ and $C\cap\left[\frac23,1\right]$ towards each other to meet at $\frac12$.