QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 512 MB 満点: 10 難易度: [表示]

#2119. Disturbances [C]

統計

In network communication, it is very important to use network protocols that ensure the data sent by the sender matches the data received by the recipient. Failure to do so can result in difficulties for the recipient in correctly reading the message. This is the situation Bajtek and Bitek found themselves in.

Bajtek wanted to send a sequence of $n$ lowercase English letters to Bitek over the internet. To do this, Bajtek's computer converted each consecutive letter of the sequence into its eight-bit ASCII representation:

Letter ASCII Code Letter ASCII Code
a 01100001 n 01101110
b 01100010 o 01101111
c 01100011 p 01110000
d 01100100 q 01110001
e 01100101 r 01110010
f 01100110 s 01110011
g 01100111 t 01110100
h 01101000 u 01110101
i 01101001 v 01110110
j 01101010 w 01110111
k 01101011 x 01111000
l 01101100 y 01111001
m 01101101 z 01111010

It is easy to notice that the $i$-th lowercase letter of the English alphabet ($1 \le i \le 26$) receives an ASCII code that is the binary representation of the number $96 + i$.

Next, Bajtek's computer concatenated the $n$ eight-bit sequences into one long bit string of length $8n$ — the representation of Bajtek's $n$-character sequence. Finally, Bajtek's computer sent this representation over the internet to Bitek's computer. Unfortunately, each bit was sent in a separate network packet, which meant the bits could arrive at Bitek's end in a completely different order than the original!

The shuffled bit string finally reached Bitek. Of course, such a bit string does not necessarily represent any $n$-character sequence of lowercase English letters. Despite the fact that the bit string contains no additional information about their correct order, Bitek decided not to give up. He decided to try to recover any sequence of $n$ lowercase English letters whose representation as a sequence of $8n$ bits could have arrived at Bitek in this form. Help him and find such an example sequence — or state that one does not exist!

Input

The first line of input contains a single integer $n$ ($1 \le n \le 10^5$).

The second line of input contains a binary word of length $8n$, which represents the sequence of bits received by Bitek.

Output

If the sequence received by Bitek does not correspond to any word of length $n$ consisting solely of lowercase English letters, the output should contain a single word NIE.

Otherwise, the output should contain any sequence of $n$ characters consisting of lowercase English letters that, after being encoded by Bajtek's computer and sent over the network, could have arrived as the bit string provided in the input. If there are multiple valid character sequences, you may output any one of them.

Examples

Input 1

2
1100000011110111

Output 1

ao

Input 2

8
1011111010101100011011011010001010100011111111110001001001011010

Output 2

potyczki

Input 3

1
00011000

Output 3

NIE

Note

The letter a is represented in ASCII by the bit sequence 01100001, and the letter o is represented by 01101111. The sequence ao sent to Bitek was therefore converted into the sequence 0110000101101111. The message bits could have arrived at Bitek's computer in the order 1100000011110111.

Subtasks

In some groups, an answer always exists. Furthermore, in these groups, the bits during transport from Bajtek to Bitek changed their order only within the ASCII codes to which they belonged. In other words, no bit moved outside the 8 positions that represented its original letter. Despite this, when reconstructing the sequence, you may swap bits freely.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.