Ruffles cost $3.49 per bag. Chips-Ahoy cost $3.99 per bag. Bobby spent 42.39. If he bought 5 more bags of Chip-Ahoy than Ruffles, how many bags of each snack did he buy?

Ruffles --- x bags

chips ----- x+5 bags

solve for x

3.49x + 3.99(x+5) = 42.39