Show that if $T$ is a subset of $S$ having more than $16$ elements then $T$ contains two elements whose distance is at most $2$. 
Let $S = \{0000000, 0000001, ... , 1111111 \}$ be the set of all
  binary sequences of length $7$. The distance of two elements $s_1
,s_2 \in S$ is the number of places in which $s_1$ and $s_2$ differ.
  Show that if $T$ is a subset of $S$ having more than $16$ elements
  then $T$ contains two elements whose distance is at most $2$.

For example, $0001011$ and $1001010$ have distance $2$, since they differ in positions $1$ and $7$.
This problem is not clear to me. I think it's possible to take the pigeonhole principe.
Does someone could help me solve the problem? OR even just a hint would be enough?
 A: Each word has exactly $7$ words at distance $1$, so it "occupies" a total of $8$ words. $17\cdot 8>128$.
A: The argument given by Hagen can be generalized a bit. If you have a set $S$ of $k$ binary words of length $n$ that are at distance at least $d$ apart then for each word $w$ you can consider the set of words that are at distance $n/2$ or less from $w$. These sets are going to contain $\binom{n}{0}+\binom{n}{1}+\binom{n}{2}+\dots \binom{n}{d/2}$ words each and are going to be disjoint, since if $w$ and $w'$ had a common word in their sets then $w$ and $w'$ would be at distance less than $d$ apart, which does not happen because of the construction of $S$). This is going to prove the existance of at least $k(\binom{n}{0}+\binom{n}{1}+\binom{n}{2}+\dots \binom{n}{d/2})$ words, which is a contradiction whenever that product is larger than $2^n$.
In our case $n=7,k=17,d=2$ and indeed we obtain:
$17(\binom{7}{0}+\binom{7}{1})>2^7$.
I learned this technique trying to solve the following slightly harder problem from a brazilian olympiad:
Show that we cannot form more than $4096$ binary sequences of length $24$ so that any two differ in at least $8$ positions.
