School Register
Limits: 2 sec., 512 MiB
This statement was translated automatically from Ukrainian.
Student, do you know how teachers fill out the gradebook?
One day, the computer science teacher was filling out the gradebook with grades for \(n\) students. For each student, they first wrote the last name and then the first name.
And now the school principal demands that the teacher submit the gradebook in a new format, where the first name is indicated first, and then the last name.
For each student in the teacher’s gradebook, a string of Latin letters is recorded, consisting of the student’s last name and first name without a space. The first letter of the last name and the first letter of the student’s first name are uppercase, all other letters are lowercase.
In the new format, a string of Latin letters must also be recorded for each student, however, the first name must be recorded first, and then the last name, without a space. The first letter of the last name and the first letter of the student’s first name remain uppercase, all other letters are lowercase.
For example, the teacher’s gradebook could contain records for \(n=4\) students:
TkachenkoOleksii, BoikoMaryna,
KovaliukDmytro, LysenkoOlha.
After converting the gradebook to the new format, the list of students should become:
OleksiiTkachenko, MarynaBoiko,
DmytroKovaliuk, OlhaLysenko.
Your task, student, is to help the teacher fill out the gradebook in the new format.
Input
The first line gives the integer \(n\) — the number of students in the gradebook.
The next \(n\) lines give the list of students in the teacher’s gradebook.
Output
Output \(n\) lines — the list of students in the new format gradebook. The order of students in the list must be the same as in the input data.
Constraints
\(1 \le n \le 100\),
each student’s last name contains at least one letter,
each student’s first name contains at least one letter,
the total length of each student’s last name and first name does not exceed \(74\) characters.
Scoring consists of the following blocks:
1 point for each example from the statement,
47 points: \(n = 1\),
15 points: the last name consists of only one letter,
15 points: the first name consists of only one letter,
21 points: no additional constraints.
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 4 TkachenkoOleksii BoikoMaryna KovaliukDmytro LysenkoOlha | OleksiiTkachenko MarynaBoiko DmytroKovaliuk OlhaLysenko |
| Input (stdin) | Output (stdout) |
|---|---|
| 1 AB | BA |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|