Decoding V77873


Statement
 

pdf   zip   main.cc

thehtml

The decoding of a natural number n is a string of characters such that every two digits of n represent a character. For example, the decoding of n = 6568 is AD, because the ASCII code of the character A is 65 and the ASCII character of the character D is 68. Notice that n has two groups of two digits: 65 and 68. Another example: the decoding of 65666768 is ABCD, since n is composed of 65, 66, 67, and 68.

It is necessary to implement the recursive function void decodificacio(int) with the following specification:

PRE: The input is an integer n such that:

  1. n ≥ 65
  2. n = d1 d2 d3 d4dm−1 dm.
  3. m is even
  4. for any pair of digits di di+1 (i odd) we have that 65 ≤ di di+1 ≤ 90.

POST: writes the decoding of n to the output channel cout.

Observation

Only recursive solutions are accepted.

IMPORTANT: You only need to submit the requested function, and possibly other necessary actions and functions. However, you must keep the type definitions and #includes.

Input

The input consists of a natural number n ≥ 65 such that n = d1d2d3d4dm−1dm m is even and for any pair of digits di di+1 such that i is odd, we have that 65 ≤ di di+1 ≤ 90.

Output

For each integer n, its decoding.

Sample session
decodificacio(65666768) => "ABCD"
decodificacio(6568) => "AD"
decodificacio(676665) => "CBA"
decodificacio(88) => "X"
Information
Author
PRO1
Language
English
Translator
Original language
Catalan
Other languages
Catalan Spanish
Official solutions
C++
User solutions
C++