Let $S$ be the set of all strings of $0$'s and $1$'s, and define $D:S \rightarrow \mathbb{Z}$ as follows: For all $s\in S$, $D(s)= \text{the number of}\,\, 1$'s in $s$ minus the number of $0$'s in $s$.
a. Is $D$ one-to-one(injective)? Prove or give counterexample if it is false. b. Is $D$ onto(surjective)? Prove or give a counterexample.
a. I know $D(S1)\neq D(S2)$ and $S1=S2$. Since $11000\neq 10100$ but $D(11000)=-1$ and $D(10100)=-1$. So does that means that D is not one-to-one?
b. ?