Proving/Disproving a fact about open set of $\mathbb{R}$ 
Let $S\subset\mathbb{R}$ be an open set and $x\in S$. Let $T \subset S$ be the
  largest open interval containing $x$, then $S\setminus T$ is an open
  set.


My attempt:
Let $y\in S\setminus T$. Then $y \in S$ and $y \not\in T$. Since $y \in S$ and $S$ is an open set, there exists a neighborhood $I \subset S$ of $y$. We will now show that every element $z \in I$ is not in the set $T$. Otherwise if there were some element $z$ in $I$ such that $z$ is in $T$, then $T\cup I$ is a neighborhood of $z$ and so for $x$. But $T$ was the largest open interval containing $x$ (a contradiction!); thus we have that every element $z \in I$ is not in the set $T$. Thus, $I \subset S\setminus T$ and we conclude that $S\setminus T$ is an open set.

Is this proof okay or are there any counterexamples to this proposition?
 A: Since the open intervals form a basis for the topology, an open set $S$ in $\Bbb R$ is a union of disjoint open intervals (finite intersections of open intervals are also open intervals).  So which ever one $x$ is contained in,  will be $T$.  Then $S\setminus T$ will be the union of the remaining intervals,  hence open.  
So this exercise is really about what the open sets in $\Bbb R$ "look like".  
Your way looks ok.
A: One should first ensure that such a largest interval exists. Let $A=\{s\in S:[x,s)\subseteq S\}$. The set is not empty, because there is at least an interval containing $x$ and contained in $S$. Let $q=\sup A$ (might be $\infty$). Suppose $[x,q)\not\subseteq S$. Then there is $y\in[x,q)$, $x\notin S$; since $y<q$, there is $z\in S$ with $z\in A$. Contradiction.
By definition of supremum, no interval of the form $[x,z)$, with $z>q$, can be contained in $S$.
Similarly, if $B=\{s\in S:(s,x]\subseteq S\}$, then $(p,x]\subseteq S$, where $p=\inf B$ (might be $-\infty$).
Now, let $z\in T=S\setminus(p,q)$. Take an interval $(a,b)$ such that $z\in(a,b)\subseteq S$.
If $(a,b)\cap(p,q)\ne\emptyset$, we have that $(a,b)\cup(p,q)$ is an interval containing $x$ and contained in $S$; therefore $(a,b)\subseteq(p,q)$: a contradiction to $z\notin(p,q)$.
