Suppose that Megan and Shana competed in exactly n races.
Since Shana won exactly 2 races, then Megan won exactly n − 2 races.
Since Shana won 2 races and lost n − 2 races, then she received 2x + (n − 2)y coins.
Thus, 2x + (n − 2)y = 35.
Since Megan won n − 2 races and lost 2 races, then she received (n − 2)x + 2y coins.
Thus, (n − 2)x + 2y = 42.
If we add these two equations, we obtain

(2x + (n − 2)y) + ((n − 2)x + 2y) = 35 + 42 or
nx + ny = 77 or n(x + y) = 77.

Since n, x and y are positive integers, then n is a positive divisor of 77, so n = 1, 7, 11 or 77.
Subtracting 2x + (n − 2)y = 35 from (n − 2)x + 2y = 42, we obtain
((n − 2)x + 2y) − (2x + (n − 2)y) = 42 − 35
or (n − 4)x + (4 − n)y = 7 or (n − 4)(x − y) = 7.

Since n, x and y are positive integers and x > y, then n−4 is a positive divisor of 7, so n−4 = 1
or n − 4 = 7, giving n = 5 or n = 11.
Comparing the two lists, we determine that n must be 11.
Thus, we have 11(x + y) = 77 or x + y = 7.
Also, 7(x − y) = 7 so x − y = 1.
Adding these last two equations, we obtain (x + y) + (x − y) = 7 + 1 or 2x = 8, and so x = 4.
(Checking, if x = 4, then y = 3. Since n = 11, then Megan won 9 races and Shana won 2 races.

Megan should receive 9(4) + 2(3) = 42 coins and Shana should receive 2(4) + 9(3) = 35 coins,
which agrees with the given information.)

**Answer: (E)**