Decoding V77873


Statement
 

pdf   zip   main.cc

The decoding of a natural number nn is a string of characters such that every two digits of nn represent a character. For example, the decoding of n=6568n = 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 nn has two groups of two digits: 6565 and 6868. Another example: the decoding of 6566676865666768 is ABCD, since nn is composed of 6565, 6666, 6767, and 6868.

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

PRE: The input is an integer nn such that:

  1. n65n \geq 65

  2. n=d1d2d3d4dm1dmn = d_1 d_2 d_3 d_4 \dots d_{m-1} d_m.

  3. mm is even

  4. for any pair of digits didi+1d_i d_{i+1} (ii odd) we have that 65didi+19065 \leq d_i d_{i+1} \leq 90.

POST: writes the decoding of nn 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 n65n \geq 65 such that n=d1d2d3d4dm1dmn = d_1d_2d_3d_4 \dots d_{m-1}d_m mm is even and for any pair of digits didi+1d_i d_{i+1} such that ii is odd, we have that 65didi+19065 \leq d_i d_{i+1} \leq 90.

Output

For each integer nn, 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++