Prof. Rajyaguru is working on creating encryption techniques
to encrypt the messages he sends to his colleague.
He encrypts the message by following procedure
-He replaces all the spaces in message by '*' character.
-He takes characters of message and puts it in a grid of K
columns(where K > 1).
-He fills remaining character in a grid by '$' character
-He then reads the message by column wise and from the bottom of the grid.
For Example:
If the message is : Welcome to CodeTrac And the value of K is 4 (columns = 4) The grid will be:
W e l c o m e * t o * C o d e T
r a c $
Encrypted Message will be : rotoWadomece*el$TC*c
Input
Command Line Arguments: First Argument will be value of K and second argument will be message to be encrypted Output Format:
Encrypted message
Example
Example 1: Command Line Argument: 4 "Welcome to CodeTrac"
Output: rotoWadomece*el$TC*c
Example 2: Command Line Argument: 3 "Meet me in my office"
Output: cfynetMef****e$iomime
Example 3: Command Line Argument: 5 "Meet me in my office"
Output: f*mMfmeeiy*ec*iteon*
solution
under construction
No comments:
Post a Comment