In the event of technical difficulties with Szkopuł, please contact us via email at email@example.com.
If you are familiar with IRC chat, the support team is also reachable on PIRC network (
#szkopul channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
You need to print words on a movable type printer. Movable type printers are those old printers that require you to place small metal pieces (each containing a letter) in order to form words. A piece of paper is then pressed against them to print the word. The printer you have allows you to do any of the following operations:
Initially, the printer is empty; it contains no metal pieces with letters. At the end of printing, you are allowed to leave some letters in the printer. Also, you are allowed to print the words in any order you like.
As every operation requires time, you want to minimize the total number of operations.
You must write a program that, given the words you want to print, finds the minimum number of operations needed to print all the words in any order, and outputs one such sequence of operations.
- The number of words you need to print.
Your program must read from the standard input the following data:
Your program must write to the standard output the following data:
For a number of tests, worth a total of 40 points, will not exceed 18.
For the input data:
3 print the poem
the correct result is:
20 t h e P - - - p o e m P - - - r i n t P