Question: Overview: Exploiting patterns is an important part of breaking codes. It turns out that humans are poor at randomness, and often exhibit subtle breaks from
Overview:
Exploiting patterns is an important part of breaking codes. It turns out that humans are poor at randomness, and often exhibit subtle breaks from randomness that can be exploited. One such example would be generating a set of random letters or a random password. A truly random password could include any character and may include repeats of characters. A human would feel that this is somehow not random enough and so might choose a key from the left side of the keyboard, followed by one on the right, and so on This leads to an exploitable pattern. We will explore such patterns in actual words by using trees.
In this case, we will read two sets of letters from a file and use them to parse a large number of words from the yawl.txt file using the sets of letters. This file contains a large number of words that are generally accepted for word puzzles. We will then find words that match a number of requested letter patterns.
Input files
The input files contain several lines indicating the details of the letter sets and requested patterns. All input files are well formed with valid values. There is no need for exception handling on the inputs and all files follow the same format.
The first two lines provide sets of letters for a binary split. The lines begin with a single character that represents the set of letters. The remainder of the line is the letters that are part of this set, each separated by a comma and a space. The two sets need not be disjoint they may include overlaps and may not include all the letters. There will be exactly two nonempty sets of letters.
The next lines are numbered and contain only the characters representing the two letter sets. They provide a requested pattern for words. There will always be requests, but the number of requests may vary. They will always be numbered starting from one and increasing by one. The requests will always be well formed and contain only the two characters representing the letter sets.
For example, the inputtxt contains:
L: Q W E R T A S D F G Z X C V B
R: Y U I, O P H J K L N M
LRLR
RRRR
LLLL
The first line is designated L and includes all the letters that can be typed with the left hand on a standard QWERTY keyboard. The second line is designated R and represents all the letters that can be typed with the right hand. The next three lines are numbered and include a pattern of letters. The first pattern, for example, is words formed from letters typed with the left hand, then right, then left, and then right. The second pattern is the fourletter words that can be typed with only the right hand. The third pattern is the fourletter words that can be typed with only the left hand.
Output files
The output files should contain one line for each of the requested patterns. The lines should be numbered to match the inputs, with a period and space following the number. The lines should contain all the words that match the requested pattern, separated by a comma and space.
If there are no matching words, the line should contain the message: No Matching Words
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
