Below, you can find another hint for the Challenge.
You should only get here after reading, digesting, and applying the .
The problem with the current approach using markers is that in order to recognize markers we need to put them in the program somehwere. And we did that literally. Remember that in our previous program we had the statement:
containing '|'. Therefore, the string S will have to contain something that produces these three characters. The quotes cannot be put literally in S (we introduced the quote marker for that reason), and if we put the vertical bar literally inside S, then this occurrence of the vertical bar should not be translated into a newline, but should be written literally. The problem with our previous program is that these occurrences also got translated, giving rise to a spurious newline and a quoted quote.
So, the options are
The second approach could be made to work, but is more involved than you might believe at first sight. The first is easier, especially when one can also avoid the additional quotes in the program.
There are various ways in which one can avoid the literal occurence of the marker(s) in the program (but outside the string literal S).
The sneaky idea of approach 1a is to express the translation of newline markers by a statement of the form:
where the three dots are replaced by an appropriate index value.
Can you develop this into a solution?
Try your program in the machine, and see if you can extend it to a complete solution.
It is your turn ...
If you tried this hint, or do not see how it helps, then you are ready for the .