Slanted Cipher Algorithm

A string is being encoded using a slanted transposition cipher that uses an integer numberOfRows. For example, assume the input string is ‘my name is’ and the number of rows is 3.The input string is encoded in a slanted fashion in 3 rows as given below. Gaps in the string are taken as blank characters.The output is then read row-wise, with the gaps being read as underscores.Hence, for the example given in the Capture1

the given encoded input string ‘mnes__ya_____mi’ reads as ‘my name is’ after decoding, which is the required output. Given the number of rows used and the encoded string, find the required output string.