Let x = Sarah's sweets
Let y = Henry's sweets
Since we are given the ratio as 5:6 we can write that as a fraction 5/6 and set it equal to x/y.
Next we set up an equation for the second ratio 1/2. This will be equal to Sarah's original sweets minus the sweets she ate, divided by Henry's sweets.
So now we have two equations with two unknowns that we can solve by substitution.
5/6 = x/y and 1/2 = (x-16)/y