Below, you can find another hint for the Challenge.
You should only get here after reading, digesting, and applying the .
Let us first merge the two loops, thereby simplifying the program somewhat:
It is a little bit shorter (maybe clearer too), and still writes the same output ().
Now, we can put in the newline markers (not forgetting the extra spaces for indentation) and their processing. Here is an attempt:
and verify that the newline markers work as intended. Note that the trailing writeln(); is no longer needed, because we put a newline marker at the end of the string literal S.
Did you notice that we forgot to update the string literal by including the program fragment for marker processing? Can you finish the program?
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 .