Let's assume
the number of bags of candy =x
the number of bags of cookies =y
There were 5 more bags of cookies sold than candy
so, we get

Bags of candy cost $5.50
so, total cost of candy is

bags of cookies cost $3.50
so, total cost of cookies is

so,
total cost = (total cost of candy)+(total cost of cookies)
we get
total cost =5.50x+3.50y
so, we can plug

now, we can plug y








now, we can find y



so,
the number of bags of candy =4
the number of bags of cookies =9............Answer