Solution of the Week #389 - Strings

There are two overall cases: the 3 digit in the sum could be made from a 1 in the first number and a 2 in the second number, or vice versa.

In the first case, that means the first four digits of the first number must also be 1s, and so the first four digits of the second number must all be 3s. We have no choice. However for the ‘444’ at the end of the sum, we have some choice. The first of those 4s must be 2+2 (as otherwise the first number wouldn’t have any 2s). The last digit must be made of 3+1. However the middle of those 4s could be either, giving us two possibilities.

If instead the 3 in the sum is made of 2 in the first number plus 1 in the second number, now the second half of the sum is completely determined and we have some choice towards the start of the number, three possibilities in fact.

So altogether the five possibilities are:

 

11111223+

33332221

 

11111233+

33332211

 

11122333+

33321111

 

11222333+

33221111

 

12222333+

32221111