topic
Retransmitting and reordering messages is a common reliability mechanism. There are a certain number of sub-messages in the retransmission buffer. The order of each sub-message in the original message is known. Now the original message needs to be restored. .
Input description
The first line of input is N, which represents the number of sub-packets, 0 < N <= 1000.
Enter the second line of N sub-messages, separated by spaces. The sub-message format is string message content + suffix sequence index. The string message content consists of |az,AZ), and the suffix is an integer value, indicating the order. The sequence value is unique and does not repeat.
Output description:
EN outputs the original message recovered. Restore the original message according to the ascending order of each sub-message. The sequence suffix needs to be deleted from the recovered message.
Use case 1
input:4
rolling3 stone4 like1 a2
output:
like a rolling stone
Description:
The contents of the 4 sub-messages are rolling, stone, like, a, and the sequence values are 3, 4, 1, 2 respectively. The sequence values are in ascending order and the sequence suffix is deleted. Get the original message recovered: like a rolling stone
Use case 2
input:
8
Lgifts6 and7 Exchanging1 all2 precious5 things8 kinds3 of43// Note: Please note here: there are two spaces between and7 and Exchanging1.
Output:
Exchanging all kinds of precious gifts and things
Ideas
1: Simple question