Help yourself, by introducing copious debug print statements after each substitution. If you are a candidate for going insane over those kinds of problems, solving the problem for you would only delay your fate. Sometimes the only way to get out of peril is going through it... ;-)
Heh...point well taken sir! Actually the "answer" in the back of the book suggests using the \n as the placeholder. So, you're issue is with Randal, not me! ;)