A simple way of encoding a message is the railfence cypher. The message is written downwards and diagonally on rails of an imaginary fence, moving down and up. The message, Howareyou?
becomes
H . . . r . . . u . . o . a . e . o . ? . . w . . . y . . .which is then encoded as
Hruoaeo?wy
Write a method that receives a string and that returns a two-dimensional array of strings,
placing the characters as indicated in the preceding diagram. Each array element should either be null
(represented by .
above) or a string of length 1.