Let x be the number of sweets one had, and y be the number of sweets the other had.........

then;

x = 2y...................................... (i)

after each eating one, they remain with (x - 1) and (y - 1)

So;

x - 1 = 3(y - 1)

= 3y - 3

so; x = 3y - 2.................. (ii)

substitute eqn (i) into eqn (ii), we have;

2y = 3y - 2

Which means; y = 2...............(iii)

applying eqn (iii) to eqn (i)................ eqn (i) becomes

x = 2 (2)

= 4.

Therefore; one had 4 sweets and thhe other had 2 sweets.