Look at it this way:
-- Since the two groups have the ratio of 4 to 7, then the first group has 4 parts
and the other group has 7 parts.
-- If the first group has 4 parts and the other group has 7 parts, then they have
11 parts all together.
-- Those 11 parts are all parts of 33. There must be ( 33 / 11 ) = 3 items in each part.
Now you can go back to the groups . . .
-- The first group has 4 parts.
With 3 items in each part, that's (4 x 3) = 12 items.
-- The other group has 7 parts.
With 3 items in each part, that's (7 x 3) = 21 items.