One method of encoding messages is known as the “expanding square code”. This method encodes message by placing the character of the message in an odd order square matrix row by row, and then retrieving them in a clockwise expanding square spiral from the center of the matrix. If the message is not exactly the right length to fill the matrix, the rest of the matrix is filled with asterisk characters (*). For example, the two square matrices below show the order in which the characters are placed in the matrix, and the order in which they are retrieved. Notice that the order of retrieval begins at the center, then proceed to the right, and then spirals clockwise Order In Order Out 1 2 3 4 5 21 22 23 24 25 6 7 8 9 10 20 7 8 9 10 11 12 13 14 15 19 6 1 2 11 16 17 18 19 20 18 5 4 3 12 21 22 23 24 25 17 16 15 14 13 Message In: “This is a test message!!” Message Out: “stssees a a*!!egmtiThis ” Your program must be able to encode messages by this method. The input (from standard in) will consist of a string of text entered by the user, containing an unknown number of characters N (0 < N <= 1000). From the length of the message, you should determine the minimum odd order required for the matrix, and perform the specified operation. The output for you program will be the encoded message.
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more