SP31235 URJC2_F - Fractals
Description
What is a fractal? According to wikipedia: A fractal is a mathematical set that exhibits a repeating pattern displayed at every scale.
We are interested in developing a solution and create some fractals! This time we are interested on creating the ”H” fractal. The process to create it is as follows:
• At scale 1, you have the ”H-H” string
• At scale 2, you will copy the strings into four corners, each copy separated by a single space (row and column-wise)
• You must connect the vertical copies with the pipe character or ’|’ and the horizontal copies with a dash character ’-’ between the pipes that connect the vertical copies (see the samples as clarification)
• At scale 3 and further, you will repeat the step done on scale 2. Thus generating the fractal
Input Format
You will receive a single integer N denoting the scale of the H fractal we want to generate.
Output Format
You must output the generated H fractal as described above, in addition, the generated fractal MUST NOT have trailing spaces, this means that, after the last non-whitespace character of each row is printed, there must be nothing else but a newline written as output.