#K83967. Reorder Jumbled Number Pieces
Reorder Jumbled Number Pieces
Reorder Jumbled Number Pieces
Polycarp has a favorite number which is written multiple times and then jumbled into pieces. You are given n strings, each representing a fragment of this repeated number. Your task is to determine the correct order in which these fragments should be concatenated in order to reconstruct the original sequence of the number.
The correct order is determined by sorting the fragments in ascending order according to their lengths. In case two or more fragments have the same length, their relative order remains the same as in the input.
Mathematically, if the length of the i-th string is denoted by \(\ell_i\), then the fragments must be reordered so that:
[ \ell_{p_1} \leq \ell_{p_2} \leq \cdots \leq \ell_{p_n}, ]
where \(p_1, p_2, \ldots, p_n\) is a permutation of \(\{1, 2, \dots, n\}\). Output the order of indices corresponding to the sorted fragments.
inputFormat
The first line contains an integer \(n\) \( (1 \leq n \leq 10^5) \) representing the number of string fragments. Each of the next \(n\) lines contains a non-empty string consisting of digits.
outputFormat
Print a single line containing \(n\) space-separated integers, which are the original indices of the strings in the order they should be concatenated to reconstruct the full number.
## sample2
444
44
2 1
</p>