I have been self studying Classical Analysis by TBB. I stumbled on this exercise problem which I think may not be right. I am not sure what I am missing or the gap in my understanding. Here it goes.
Let $G$ be a dense open subset of $\mathbb{R}$, and let $\{(a_k, b_k)\}$ be its component intervals. Prove that $H = G^c = \mathbb{R}\G$ is perfect if and only if not two of these intervals have common end-points.
Here are my observations.
If $G$ is an open subset of $\mathbb{R}$ then we can write it as a union of disjoint intervals. I am assuming that is just redundant information.
If $G = \bigcup_0^\infty (i, i+1) \cup (-i-1, -i) : \ i \in \mathbb{N}$, clearly $G$ is an open set. It is dense in $\mathbb{R}$, but $G^c$ is not perfect.
I am attaching an image of the original problem as well. What am I missing?