Problem A
Miði
Languages
en
is
Little Jón has a crush on little Gunna. He intends to send her a note in the middle of class at school. The note will pass through the hands of many students to reach from Jón to Gunna. There is also a risk that the teacher will see the note and confiscate it. Jón is worried that his classmates, or worse, the teacher, will read the note.
That is why Jón has invented a cipher. The first step is reversing the message in the note to make it harder to read. In order to increase security, he only sends short parts of the message each time, so he will need to send multiple notes. He then sends the notes in reverse order. Jón considers himself particularly clever.
Who has not experienced receiving a love note without having any knowledge of the encryption method used to write the note? Gunna has experienced that. Therefore she cannot read the original message. Gunna is sitting in the classroom with $n$ notes and has to puzzle them together to understand them. The only information she has is the message on each note and the order in which the notes reached her. Can you help Gunna read the message?
Input
The first line of the input contains a single integer $1 \leq n \leq 2 \cdot 10^6$, the number of notes. Then $n$ lines follow, each with a single string, the text written on each note in the order they reached Gunna. The number of symbols in the original message is at most $2 \cdot 10^6$. The message will consist of only lowercase english letters and no spaces. Each note includes at least one symbol.
Output
Output one line with the original message Jón wanted to send to Gunna.
Scoring
Group |
Points |
Constraints |
1 |
50 |
$n \leq 100$, the number of symbols in the original message is at most $1\, 000$. |
2 |
50 |
No further constraints. |
Sample Input 1 | Sample Output 1 |
---|---|
3 noj vk mmbv |
vbmmkvjon |
Sample Input 2 | Sample Output 2 |
---|---|
5 gi htak s leg e |
egelskathig |