Problem

Cryptography. The science of developing secret codes has interested many people for centur...

Cryptography. The science of developing secret codes has interested many people for centuries. Some of the simplest codes involve replacing a character, or a group of characters with another character, or group of characters. To easily decode these messages, the decoder needs the “key” that shows the replacement characters. In recent times, computers have been used very successfully to decode many codes that initially were assumed to be unbreakable. The next set of problems considers simple codes and schemes for decoding them. Generate files to test the programs.

One step in decoding a simple code without knowing the coding scheme, involves counting the number of occurrences of each character. Then, knowing that the most common letter in English is ‘e,’ the letter that occurs most commonly in the coded message is replaced by ‘e.’ Similar replacements are then made based on the number of occurrences of characters in the coded message and the known occurrences of characters in the English language. This decoding often provides enough of the correct replacements that the incorrect replacements can then be determined. For this problem, write a program that reads a data file and determines the number of occurrences of each of the characters in the file. Then, print the characters and the number of times that they occurred. If a character does not occur, do not print it. (Hint: Use an array to store the occurrences of the characters based on their ASCII codes.)

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT