Question
In simple columnar transposition cipher, the plaintext is written horizontally onto a piece of graph paper with fixed width. The cipher text is then read
In simple columnar transposition cipher, the plaintext is written horizontally onto a piece of graph paper with fixed width. The cipher text is then read vertically. For example, the sentence of "THE WEATHER IS SO NICE THAT WE WANT TO PLAY" is written as the following using a graph paper width of six:
T | H | E | W | E | A | ||
T | H | E | R | I | S | ||
S | O | N | I | C | E | ||
T | H | A | T | W | E | ||
W | A | N | T | T | O | ||
P | L | A | Y | ||||
The resulting output from above would be: TTSTWPHHOHALEENANAWRITTYEICWTASEEO
Write a Java program given a string (all caps) and a positive integer width, outputs the cipher text. Refer to the sample output below.
Sample Run:
Enter the width size: 6
Enter the string: THE WEATHER IS SO NICE THAT WE WANT TO PLAY
Cipher Text: TTSTWPHHOHALEENANAWRITTYEICWTASEEO
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started