Recursive words X72048


Statement
 

pdf   zip

html

Deduce what has to be done in this problem by looking at the input-output examples.

Input

The input has several cases. Each one consists of a single digit d in one line.

Output

For each case from the input, the output has a string in a new line. Deduce the expected string for each d from the examples.

Observation

The solution for this exercise must be recursive. You can either make a recursive function which directly prints the string on the output, or a function that returns the string and it is the main program who prints it. You can use a loop in the body of the function, if you wish, but the general solution must be recursive.

Public test cases
  • Input

    0
    1
    2
    3
    4
    

    Output

    0
    101
    210121012
    3210121012321012101232101210123
    432101210123210121012321012101234321012101232101210123210121012343210121012321012101232101210123432101210123210121012321012101234
    
  • Information
    Author
    PRO1
    Language
    English
    Translator
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    C++
    User solutions
    C++