Editorial for WC '15 Finals J1 - Vertical Posting


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

We are asked to display the input string in the format specified. Note that the string is a single word with no spaces, so most programming languages will have no trouble with input. To display the horizontal section of the posting, we should print the input string with a single space between adjacent letters. This can be done with a loop through the indices of the string, and printing a space before printing each character. We should neglect to print a space only for the first iteration of the loop. Alternatively, we can print a space after printing each letter (except for the last). Then, we can print a newline character to start the vertical part of the posting. For the vertical part, we loop through the string once again, except this time starting at the second letter. For each letter printed, we also must print a newline character afterwards.


Comments

There are no comments at the moment.