If $E$ is a closed set there exist a set $S$ such as $E=S'$ In "Elementary Real Analysis" by Thomson-Bruckner p.190 I did the following exercise: (we're working on $\mathbb{R}$ and elementary topology on that set)

One of Cantor's early results in set theory is that for every closed set $E$ there is a set $S$ with $E=S'$. Attempt a proof.

My proof was pretty long and complicated and whatever I'd like to know other proofs because each proof can teach something new. I looked in Internet but I couldn't find any proof whatever I type on Google. Can you please tell me if you know any?
Edit: $S'$ is the set of limit points (accumulation points) of $S$.
 A: Proof sketched in the comments.
Let $E\subset\mathbb{R}$ a closed set. Thus $E'\subset E$.
Therefore $E=E'\cup (E\backslash E')$.
Let $x\in E\backslash E'$.
We have $x\notin E'$ thus $x$ isn't an accumulation point,i.e., $\exists\rho (x)>0,\,(x-\rho (x),x+\rho (x))\cap E=\{ x\}$
Set $\delta (x)=\frac{\rho(x)}{3}$. Obviously: $$\forall x,y\in E\backslash E',\, x\neq y\Rightarrow [x-\delta (x),x+\delta (x)]\cap [y-\delta (y),y+\delta (y)]=\emptyset\tag{1.0}$$
Set $N_x=\left\lfloor\frac{1}{\delta (x)}\right\rfloor+1$ where $x\mapsto\left\lfloor x\right\rfloor$ is the floor function and let $n\in\mathbb{N}$ such as $n\ge N_x$.
We have $\frac{1}{\delta (x)}<N_x\le n\Rightarrow \frac{1}{n}<\delta (x)$
Thus: $$\forall n\ge N_x,\,x-\delta (x)<x<x+\frac{1}{n}<x+\delta (x)\tag{1.1}$$
Set $S_x=\{ x+\frac{1}{n}\,/\,n\in\mathbb{N}\cap [N_x,\,+\infty)\}$. According to $(1.1)$:
$$S_x\subset (x-\delta (x),x+\delta (x))$$
Set $S=\bigcup\limits_{x\in E\backslash E'}S_x$.
Let $x\in E\backslash E'$ and set the sequence $\{ x_n\}$ defined by: $\forall n\ge N_x,\,x_n=x+\frac{1}{n}$. We have $\forall n\ge N_x,\,x_n\in S_x\subset S$. Since $\lim\limits_{n\to +\infty}x_n=x$ therefore $x$ is an accumulation point of S,i.e., $x\in S'$. Thus $E\backslash E'\subset S'$.
Let $y\in\mathbb{R}\backslash E$.
$E'\subset E$ thus $y\notin E'$. Therefore $\exists\varepsilon >0,\,(y-\varepsilon ,y+\varepsilon )\cap E=\emptyset\tag{1.2}$
Case 1: Suppose that: $\forall x\in E\backslash E',\,(y-\varepsilon ,y+\varepsilon )\cap S_x=\emptyset$ then $(y-\varepsilon ,y+\varepsilon )\cap S=\emptyset$. Thus $y\notin S'$.
Case 2: Suppose that: $$\exists x_0\in E\backslash E',\,(y-\varepsilon ,y+\varepsilon )\cap S_{x_0}\neq\emptyset\tag{1.3}$$
According to $(1.2)$, $x_0\notin (y-\varepsilon ,y+\varepsilon )$. Thus $x_0\le y-\varepsilon $ or $x_0\ge y+\varepsilon $. But since we have $(1.3)$, according to $(1.1)$ we can't have $x_0\ge y+\varepsilon$ ($(1.3)$ won't be true) and $y-\varepsilon <x+\delta (x_0)$ ($(1.3)$ won't be true).
Suppose the existence of $x\in E\backslash E'$ different than $x_0$ and that satisfies too $(1.3)$. We can suppose $x_0<x$ (otherwise substitute $x$ by $x_0$). We have then $x_0<x\le y-\varepsilon <x_0+\delta (x_0)$. Thus $x\in (x_0-\delta (x_0),x_0+\delta (x_0))$. Therefore $[x_0-\delta (x_0),x_0+\delta (x_0)]\cap [x-\delta (x),x+\delta (x)]\neq\emptyset$ which contradicts $(1.0)$. Thus:$$\exists !x_0\in E\backslash E',\,(y-\varepsilon ,y+\varepsilon )\cap S_{x_0}\neq\emptyset\tag{1.4}$$
We choose for $\varepsilon $ the half of its initial value in case of $x_0=y-\varepsilon $ so that we get $x_0< y-\varepsilon $. Let's prove that $(y-\varepsilon ,y+\varepsilon )\cap S_{x_0}$ is a finite set.
Set $L=(y-\varepsilon ,y+\varepsilon )\cap S_{x_0}$ and $\delta =\frac{y-\varepsilon -x_0}{2}>0$. We have $L\neq\emptyset$ and $\lim\limits_{n\to +\infty}x_0+\frac{1}{n}=x_0$. Thus: $\exists N\in\mathbb{N},\forall n\ge N,\,x_0+\frac{1}{n}\in (x_0-\delta ,x_0+\delta )$. Since $x_0+\delta<y-\varepsilon $ therefore $\forall n\ge N,\,x_0+\frac{1}{n}\notin (y-\varepsilon ,y+\varepsilon )$. Thus $L\subset\{x_0+\frac{1}{n}\,\,|\,\,n\in\mathbb{N}\cap [N_{x_0},N)\}$ which is a finite set. Thus $L$ is finite.
We have:$(y-\varepsilon ,y+\varepsilon )\cap S=\bigcup\limits_{x\in E\backslash E'}(y-\varepsilon ,y+\varepsilon )\cap S_x$ $$=((y-\varepsilon ,y+\varepsilon )\cap S_{x_0})\cup\bigcup\limits_{x\in (E\backslash E')\backslash \{x_0\}}(y-\varepsilon ,y+\varepsilon )\cap S_x$$
According to $(1.4)$: $\forall x\in E\backslash E',\, x\neq x_0\Rightarrow (y-\varepsilon ,y+\varepsilon )\cap S_x=\emptyset$. Thus: $\bigcup\limits_{x\in (E\backslash E')\backslash \{x_0\}}(y-\varepsilon ,y+\varepsilon )\cap S_x=\emptyset$. Therefore $(y-\varepsilon ,y+\varepsilon )\cap S=L$. Obviously, $y\notin S'$.
We conclude by contraposition that: $\forall y\in S',\, y\in E$. Thus $S'\subset E$.
We have $E\backslash E'\subset S'\subset S'\cup E'$ and $E'\subset S'\cup E'$. Thus $E'\cup (E\backslash E')=E\subset S'\cup E'$.
On the other hand, $E'\subset E$ and $S'\subset E$. Thus $S'\cup E'\subset E$.
We conclude that: $E=S'\cup E'=(S\cup E)'\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\blacksquare$
The other proof.
Let $E\subset\mathbb{R}$ a closed set.
Let $x\in E$.
Since $\mathbb{R}=\mathbb{Q}\cup (\mathbb{R}\backslash\mathbb{Q})$ and $\mathbb{Q}\cap (\mathbb{R}\backslash\mathbb{Q})=\emptyset$ therefore either $x\in\mathbb{Q}$ or $x\in\mathbb{R}\backslash\mathbb{Q}$.
For simplisity, set $\mathbb{A}=\mathbb{Q}$ or $\mathbb{R}\backslash\mathbb{Q}$ such as $x\notin\mathbb{A}$.
$\mathbb{A}$ is dense on $\mathbb{R}$. Thus there exists a sequence $\{ x_n\}$ of elements of $\mathbb{A}$ such as $\lim\limits_{n\to +\infty}x_n=x$. Obviously, $\forall n\in\mathbb{N},\,x_n\neq x$.
Set $S_1=\{ x_n\,/\,n\in\mathbb{N},x\in E\}$
Let $x\in E$. Since $\lim\limits_{n\to +\infty}x_n=x$ and $\forall n\in\mathbb{N},\,x_n\in S_1$, we have $x\in S_1'$. Thus $E\subset S_1'$.
We will now construct a subset $S\subset S_1$ such as $S'=E$. The reason is that we may habe $S_1'\not\subset E$, so we have to "remove" the elements of $S_1'$ that aren't in $E$. To remove an accumulation point, you have to remove a neighborhood of the accumulation point from $S_1$. We'll do that in a way that won't affect any element of $E$.
Let $y\in S_1'\backslash E$.
If $\forall\delta >0,\, (y-\delta ,y+\delta)\cap E\neq\emptyset$ then $y\in E'$ since $y\notin E$. But $E$ is closed thus $y\in E$ which is a contradiction.
Therefore: $$\exists\delta (y)>0,\,(y-\delta (y),y+\delta (y))\cap E=\emptyset\tag{2.1}$$
Set $S_y=S_1\backslash (y-\delta (y), y+\delta (y))$. Obviously $y\notin S_y'$.
Set $S=\bigcap\limits_{y\in S_1'\backslash E}S_y'$.
Let $y\in S_1'\backslash E$.
Since $S'\subset\bigcap\limits_{y\in S_1'\backslash E}S_y'$ and $y\notin S_y$ therefore $y\notin S'$. Thus $S'\cap (S_1'\backslash E)=\emptyset$. And since $S\subset S_1$ therefore $S'\subset S_1'$. Thus $S'\subset E$.
Let $x\in E$.
Suppose that $x\in (S_1'\backslash E)'$, i.e:$$\forall\delta >0,\exists y\in S_1'\backslash E,\,y\in (x-\delta ,x+\delta)\backslash\{ x\}\tag{2.2}$$
Set $\Delta=\{\delta (y)\,/\,y\in S_1'\backslash E\}$
We have $\Delta\subset\mathbb{R}$ and $\Delta\neq\emptyset$ and $\Delta$ is bounded below by $0$. Thus $\Delta$ has an infimum.
Set $d=\frac{\inf\Delta}{2}>0$. According to $(2.2)$: $\exists y\in S_1'\backslash E,\,y\in (x-d,x+d)$. We have $d<\delta (y)$. We easly get: $y-\delta (y)<y-d<x<y+d<y+\delta (y)$ which contradicts $(2.1)$.
Therefore $\exists\delta (x)>0\, (x-\delta (x), x+\delta (x))\cap (S_1'\backslash E)=\emptyset$.
We can find a neighborhood $V$ of $x$ such as it doesn't accross any interval $(y-\delta (y),y+\delta (y))$. Thus $\exists N_x\in\mathbb{N},\,\forall n\ge N_x,\, x_n\in S$ because the terms extremely near $x$ weren't removed. Since $\lim\limits_{n\to +\infty}x_n=x$ we have $x\in S'$. Thus $E\subset S'$.
We conclude that: $E=S'\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\blacksquare$
