#P9048. Restore Original String

    ID: 22208 Type: Default 1000ms 256MiB

Restore Original String

Restore Original String

Given a jumbled binary string \(t'\) of length \(8n\) obtained by shuffling the concatenation of the 8-bit binary representations of a lowercase string \(s\), restore any valid string \(s\). The mapping is defined as follows: each lowercase letter is converted to its ASCII code and then represented as an 8-bit binary string. For example, \(a \to 97 \to 01100001\).

In other words, if the original string is \(s=s_1s_2\ldots s_n\), then for each \(s_i\) we have an 8-bit binary representation. Concatenating these produces a binary string \(t\) of length \(8n\). This string \(t\) is then arbitrarily shuffled (i.e. its bits are rearranged) to form \(t'\). You are given \(t'\) and asked to find any string \(s\) that could have produced a binary string with the same multiset of bits.

Note: Since each 8-bit representation sums to 8 bits, if a letter \(x\) has \(z_x\) zeros and \(8 - z_x\) ones, then for the entire string \(s\) the total number of zeros is \(\sum_{i=1}^n z_{s_i}\). Given that the total number of bits is \(8n\), the total number of ones is automatically \(8n - \big(\sum_{i=1}^n z_{s_i}\big)\). Thus, it is sufficient to match the total zeros.

inputFormat

The input consists of a single line containing a binary string \(t'\) whose length is a multiple of 8. This binary string is a permutation of the concatenation of the 8-bit binary representations of a lowercase string \(s\).

outputFormat

Output any valid lowercase string \(s\) such that when each character is replaced with its 8-bit binary ASCII representation, the multiset of bits is the same as that in \(t'\).

sample

00000111
a