Translations:FP Homework 1/24/en

From Marek Běhálek Wiki
Jump to navigation Jump to search

On possibility how to encode text is to replace frequent pairs of characters by a new (until that time, not used) character. In this task, you should implement a function that decodes such encoded text. The function decode takes an encoded text and a vocabulary. Vocabulary is a sequence of pairs, where the first element is an encoded character (Char) and the second element is the original pair (as String of the length 2). The result is an original text. In fact, it is the text from the parameter, where all encoded characters were replaced by its original pairs of characters.