Obfuscation

Obfuscation of a string s = c₁c₂c₃…c_(k) with respect to a natural
number n consists of changing all the letters c_(i) ∈ s by the letter
that is n places after c_(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 n such that 0 ≤ n ≤ 20 and a string of
characters s = c₁c₂c₃…c_(k) such that k > 0 and
∀c_(i) ∈ s,^(′)A^(′) ≤ c_(i)≤^(′)F^(′).

POST: writes to the output channel cout the obfuscation of the string of
characters s with respect to n.

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 n such that 0 ≤ n ≤ 20 and a string of characters
s = c₁c₂c₃…c_(k) such that k > 0 and
∀c_(i) ∈ s,^(′)A^(′) ≤ c_(i)≤^(′)F^(′).

Output

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

Problem information

Author: PRO1

Generation: 2026-01-25T12:45:45.347Z

© Jutge.org, 2006–2026.
https://jutge.org
