Final answer:
Sally and Martha initially had 24 postcards each.
Step-by-step explanation:
Let's assume that both Sally and Martha had x number of postcards to begin with.
After Sally sold 18 postcards, she had x - 18 left.
According to the problem, Martha had 4 times as many postcards as Sally after this, so she had 4(x - 18) postcards.
Since both girls had the same number of postcards to begin with, we can set up an equation: x = 4(x - 18).
Solving this equation, we get:
x = 4x - 72
-3x = -72
x = 24
Therefore, both Sally and Martha initially had 24 postcards.