Hackerrank - Encryption

Problem Statement
A description of the problem can be found on Hackerrank.

Calculate a width and height of a required matrix:

  • height = ceil(length(input_string)
  • width = floor(length(input_string)

Then create a height x width matrix containing a characters from input_string. Transpose the matrix and print all rows.

Node: Instead we can print all columns of the prepared matrix. For 2 characters i and j in the input_string holds that they are in the same column if i mod height = j mod height.

I created solution in 4 languages:

All solutions are also available on my GitHub.