Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
$\begingroup$While technically correct and nicely painted, this answer provides little explanation as to its conclusion. How do we know that O is -2 and H is +1, really? Are they always this way? Well, good like trying to apply that to $\ce{H2O2}$.$\endgroup$
$\begingroup$Electronegativity. What is the possible oxidation states for oxygen and hydrogen? Oxygen is the more electronegative element of the compound. So, his charge will be -2, and the hydrogen is bonded with the oxygen so his charge will be +1. The sulphur charge is consequence.$\endgroup$