Problem Statement | |||||||||||||
When text is encoded using Huffman codes, each symbol is replaced by a string of 0s and 1s called a bit string representation. The replacement is done in such a way that the bit string representation of a symbol is never the prefix of the bit string representation of any other symbol. This property allows us to unambiguously decode the encoded text. You will be given a String archive and a String[] dictionary. The i-th element of dictionary will be the bit string representation of the i-th uppercase letter. Decode archive using dictionary and return the result as a single String. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | archive will contain between 1 and 50 characters, inclusive. | ||||||||||||
- | archive will contain only the characters '0' (zero) and '1' (one). | ||||||||||||
- | dictionary will contain between 1 and 26 elements, inclusive. | ||||||||||||
- | Each element of dictionary will contain between 1 and 50 characters, inclusive. | ||||||||||||
- | Each element of dictionary will contain only the characters '0' (zero) and '1' (one). | ||||||||||||
- | No element of dictionary will be a prefix of any other element of dictionary. | ||||||||||||
- | archive will be decodable using dictionary | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|