Recursive Fib. Splice

Rail Fence Cipher

Problem Description

The Rail Fence Cipher is a text-encryption method where letters from a text are placed in three rows, moving diagonally left to right (see photo). The three rows are then combined and the result is the encrypted text. Spaces are treated like letters. (Coincidentally, the space retains its position in the example photo.) Create two functions; a Rail Fence Cipher encryption function and a function that decrypts and restores the text.

Rail Fence example

Solving the Problem

*The blue comments below are examples of the approach.

rail fence solution rail fence solution

Recursive Fib. Splice