Question: please explain each block of code as comment lines. also please make sure the program runs as it shows in the description (sample input and

 please explain each block of code as comment lines. also please

please explain each block of code as comment lines. also please make sure the program runs as it shows in the description ("sample input" and "output format"). thanks

2. Transposition Cipher (encrypt.c): A very simple transposition cipher encrypt(s) can be described by the following rule: If the length of Sis 1 or 2, then encrypt(S) is S. If S is a string of N characters 51 52...Sn and k=[N/2), then enc(S)=encrypt(skSk-1...251)+encrypt(SNSN-1...Sk+1) where + indicates string concatenation. For example, encrypt("OK")="OK" and encrypt("12345678")="34127856". Write a program to implement this cipher, given an arbitrary text string from keyboard, up to 8192 characters. It's better to write a separate encryption function, similar to the following: char* encrypt(char *string, size_t length) { // you fill this out } Input Format: an arbitrary string (with the length up to 8192 characters). Sample Input: Test early and often! Output Format Line 1: One integer: the total number of characters in the string. Line 2: The enciphered string Sample Output: 21 aeyrlet sttflenn aod Implementation hint: it is obvious that encrypt() function should be a recursive function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!