You need to know that for most of the time, the oxidation number of hydrogen atom is +1 (except when it is a metal hydride, where oxidation number is -1) and the oxidation number for Oxygen is -2 (except for peroxides where it is is -1 I believe).
A neutral compound or atom's oxidation number is always equal to zero.
So let's look at H2S. We know that hydrogen's oxidation number is +1. There are two hydrogens, so the overall oxidation number of hydorogen is 2 x 1 = 2. We don't know what Sulfur's oxidation number is. We can find it out by
(2 x 1) + (x) = 0 (where x is the Sulfur's oxidation number and 0 is there because H2S is a neutral compound).
Therefore x=-2 (Sulfur's oxidation number is -2).
Let's look at SO2 (keep in mind that we need to calculate Sulfur's oxidation number here as well because it is bonded to a completely different atom).
Oxidation no. of oxygen is -2. There are two oxygen, so overall oxidation number for oxygen is -4
Therefore, (-4) + x = 0 (where X is again the oxidation number is Sulfur and 0 is there because SO2 is neutral)
Let's look at the product side.
Sulfur is by itself and so is neutral, therefore its oxidation no. is zero.
H2O:
We know the oxidation numbers of Hydrogen and Oxygen (+1 and -2 respectively).
/part 1