Readability <---- My Project!
According to Scholastic, E.B. Whiteâs âCharlotteâs Webâ is between a second and fourth grade reading level, and Lois Lowryâs âThe Giverâ is between an eighth grade reading level and a twelfth grade reading level. What does it mean, though, for a book to be at a âfourth grade reading levelâ?
Well, in many cases, a human expert might read a book and make a decision on the grade for which they think the book is most appropriate. But you could also imagine an algorithm attempting to figure out what the reading level of a text is.
So what sorts of traits are characteristic of higher reading levels? Well, longer words probably correlate with higher reading levels. Likewise, longer sentences probably correlate with higher reading levels, too. A number of âreadability testsâ have been developed over the years, to give a formulaic process for computing the reading level of a text.
One such readability test is the Coleman-Liau index. The Coleman-Liau index of a text is designed to output what (U.S.) grade level is needed to understand the text.
Implementation
Implement a program that computes the approximate grade level needed to comprehend some text, per the below.
Example
$ ./readability
Text: Congratulations! Today is your day. You're off to Great Places! You're off and away!
Grade 3
Substitution <---- My Project!
In a substitution cipher, we âencryptâ (i.e., conceal in a reversible way) a message by replacing every letter with another letter. To do so, we use a key: in this case, a mapping of each of the letters of the alphabet to the letter it should correspond to when we encrypt it. To âdecryptâ the message, the receiver of the message would need to know the key, so that they can reverse the process: translating the encrypt text (generally called ciphertext) back into the original message (generally called plaintext).
A key, for example, might be the string NQXPOMAFTRHLZGECYJIUWSKDVB
. This 26-character key means that A
(the first letter of the alphabet) should be converted into N
(the first character of the key), B
(the second letter of the alphabet) should be converted into Q
(the second character of the key), and so forth.
A message like HELLO
, then, would be encrypted as FOLLE
, replacing each of the letters according to the mapping determined by the key.
Letâs write a program called substitution
that enables you to encrypt messages using a substitution cipher. At the time the user executes the program, they should decide, by providing a command-line argument, on what the key should be in the secret message theyâll provide at runtime.
Implementation
Design and implement a program, substitution
, that encrypts messages using a substitution cipher.
Example
Hereâs how the program might work if the user provides a key of VCHPRZGJNTLSKFBDQWAXEUYMOI
and a plaintext of hello, world
:
$ ./substitution VCHPRZGJNTLSKFBDQWAXEUYMOI
plaintext: hello, world
ciphertext: jrssb, ybwsp