P9048 [PA 2021] Interference
Description
Define a mapping from lowercase letters to 8-bit binary strings:
- Convert the ASCII code of a lowercase character into an 8-bit binary number. For example: $a \rightarrow 97 \rightarrow 01100001$.
Now A has a string $s$ of length $n$ that contains only lowercase letters. He maps this string into a binary string $t$ of length $8n$.
He shuffles the binary string $t$ and gets another binary string $t'$. Please restore one possible $s$ based on the shuffled result.
Input Format
The first line contains an integer $n$.
The second line contains a binary string $t'$ of length $8n$.
Output Format
If there is a solution, output one line containing a string $s$ of length $n$ consisting only of lowercase letters. Otherwise, output `NIE`.
**If there are multiple solutions, output any one of them.**
Explanation/Hint
For $100\%$ of the testdata, $1 \leq n \leq 10^5$.
Translated by ChatGPT 5