< previous page page_619 next page >

Page 619
Data Set One
Data Set Two
21
21
32
32
76
76
22
22
21
21
-4
-4
21
21
32
32
76
176
22
12
21
21
Output:
Output:
The two lists are identical.
Position 3: 76 != 176
Position 4: 22 != 12

Problem-Solving Case Study Frequency of Certain Characters
0619-01.gif
Problem: You've found a secret message, written in some sort of code. After doing some research, you decide to see if it is a simple substitution cypher-a code in which each letter is replaced by a different letter. Your research tells you that the way to break this type of code is to count the occurrences of each letter in the text and compare them to the average occurrence of letters in any English text. For example, the most common letter is probably a substitute for e. You decide to write a program to count the occurrences of certain characters in a text file. Rather than count every character in the message, you decide to look just at certain characters that appear to be the most common. The characters you are interested in are input from the keyboard.
Input: A list of the characters to be counted, as read from the keyboard (the character '#' ends the list); and text to be processed character by character (in file dataFile).
Output: The characters to be counted and their frequency.

 
< previous page page_619 next page >