The First Day of School
Time limit1sMemory limit1024 MB
Given up to 12 courses, each with a name and a Tuesday, Thursday, or Saturday slot from 1 to 4, print a 4 by 3 timetable table with word-wrapped names.
- Level
Easy3 of 10
- Topics
- Implementation, String
- Solved
- No attempts yet
Problem
Vasya is a young and very promising android. Today is his first day at university. Vasya carefully studied the list of all courses posted on the wall near the Dean's office and chose the ones he will attend. Now he wants to write his own weekly timetable. Help him do this.
Input
The first line contains an integer , the number of courses Vasya will attend (). After that, each course is described in two lines.
The first line of a course description contains its name. The name may consist of up to five words, separated by exactly one space (there are no spaces before the first word or after the last one). The words consist of uppercase and lowercase Latin letters. The length of every word is from 1 to 10.
The second line of a course description contains the day of the week and the lesson number. The day is one of three values: Tuesday, Thursday, or Saturday. The lesson number is an integer from 1 to 4. No two courses Vasya has chosen take place at the same time.
Output
Output the timetable as a table of size . The first column is Tuesday, the second is Thursday, and the third is Saturday. The rows correspond to the four lessons. Each column is 10 characters wide. The height of a row equals the height of its tallest cell. If all cells in a row are empty, the row is 1 character high. If a word does not fit on the current line, it goes on the next line. Cell text is aligned to the top and left borders. Draw the table with the characters - (ASCII 45), + (ASCII 43), and | (ASCII 124).