Obfuscation S47315


Statement
 

pdf   zip   main.cc

Obfuscation of a string s=c1c2c3cks = c_1 c_2 c_3 \dots c_k with respect to a natural number nn consists of changing all the letters cisc_i \in s by the letter that is nn places after cic_i in the alphabet.

For example, ofuscacio(1,'A') = 'B', because 'B' is one place after 'A'. Other examples: ofuscacio(4,'B') = 'F' and ofuscacio(2,'AB') = 'CD'.

The function recursive void ofuscacio(int n, string s) must be implemented with the following specification:

PRE: The input is an integer nn such that 0n200 \leq n \leq 20 and a string of characters s=c1c2c3cks = c_1 c_2 c_3 \dots c_k such that k>0k > 0 and cis,AciF\forall c_i \in s, 'A' \leq c_i \leq 'F'.

POST: writes to the output channel cout the obfuscation of the string of characters ss with respect to nn.

Observation

If necessary, you can use the method pop_back() for vectors and string.

Only recursive solutions are accepted.

Just send the function. The rest will be ignored.

Input

An integer nn such that 0n200 \leq n \leq 20 and a string of characters s=c1c2c3cks = c_1 c_2 c_3 \dots c_k such that k>0k > 0 and cis,AciF\forall c_i \in s, 'A' \leq c_i \leq 'F'.

Output

For each pair n, s, the obfuscation of s with respect to n.

Public test cases
  • Input/Output

    ofuscacio(1, ABCD) → BCDE
    ofuscacio(2, ABC) → CDE
    ofuscacio(0, ABC) → ABC
    ofuscacio(5, DDFA) → IIKF
  • Information
    Author
    PRO1
    Language
    English
    Translator
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    C++
    User solutions
    C++