Prehistoric Printing


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C++, Java, Python

The university printers are broken, and the IT guy is on vacation in Aruba, so the staff are asking you, the closest computer science student, to help them fix it.

Upon further inspection, most of the printers have clogged ink and the software is all messed up, making it impossible for you to fix without some professional help. While most people can do without printing for a few days, some people, like the Vice-Chancellor, need to get some printing done urgently.

Understanding the gravity of the situation, you rush to find a 3D printer and tape a pen to it. "This'll have to do," you say, as you begin to code up the logic for the printer. Using the 3D printer to print text is rather slow compared to a regular printer. As a result, you determine that you'll let people print up to 80 characters at a time before processing the next person's print job. If they want to print more than 80 characters, they must go back into the print queue to print the remaining characters.

It's now up to you to create this algorithm and save the printing situation!

Input

The first line consists of an integer n\ (1 \leq n \leq 100), the number of print jobs.

The next n lines contain a string T\ (1 \leq T.\text{length} \leq 10^3), the text to print. T can contain uppercase and lowercase English characters, as well as spaces and full stops (periods).

Output

Output the text as you would print it on paper. If the text exceeds 80 characters, take the remaining text and put it back into the print queue.

Clarifications

  • If you break the text and there is leading/trailing punctuation, include that punctuation as well.

Example

Input 1
2
I am sending this via a makeshift printer as all of the uni printers are broken. This is an important contract you must sign in ink.
My first time printing on a printer using a ball point pen
Output 1
I am sending this via a makeshift printer as all of the uni printers are broken.
My first time printing on a printer using a ball point pen
 This is an important contract you must sign in ink.

The first item exceeds the 80-character limit, so we must break it up. The first sentence conveniently fits into the limit so we can print that first. The remaining text (including the space after the first sentence) is sent to the back of the print queue.

Then, the next print item is printed, before printing the remainder of the original text.

Input 2
2
I think therefore I am
I came I saw I conquered
Output 2
I think therefore I am
I came I saw I conquered

Both items fit within the 80-character limit, so nothing is put back into the print queue.


Comments

There are no comments at the moment.