Tony had an equal number of cranberry bars and walnut bars. He gave away 66 cranberry bars. He then had 4 times as many walnut bars as cranberry bars left. How many bars did he have at first?

If there were x of each to start, then

x = 4(x-66)

To solve this problem, let's assign variables to the numbers we need to find. Let's say Tony initially had x cranberry bars and x walnut bars.

After giving away 66 cranberry bars, Tony has x - 66 cranberry bars remaining. According to the problem, he then had 4 times as many walnut bars as cranberry bars left. So the number of walnut bars is 4 times (x - 66).

Now, we can write a mathematical equation based on the information given:
4(x - 66) = x

We can now solve this equation to find the value of x, which represents the initial number of cranberry bars and walnut bars.

4x - 264 = x (distributing 4)
3x = 264 (subtracting x from both sides)
x = 88 (dividing both sides by 3)

Therefore, Tony initially had 88 cranberry bars and 88 walnut bars.