  Lab Exercise #4 : Testing Dictionary Words for Patterns

The goal of this assignment is to write a program (using, to the maximum extent possible, regular expressions) that will go through a text file and find words that:

   1. Contain all five vowels.

   2. Begin and end with an a.

   3. Contain five or more i's.

   4. Are six or more letters long and contain none of the vowels: a, e, i, o, or u.

   5. Are palindromes** (spell the same both forward and backward).

   6. Contain three (or more) pairs of double letters.

   7. Have their letters in alphabetical order.

   8. Have an even number of 'a's. 

Your program should print a line each time that a match occurs. This print out should contain the number associated with the criteria that is matched (use the numbers in the list above), a "-" and the word which matches. If a word matches more than one criteria it should print each time that it matches. I recommend that you loop through the dictionary one time and perform eight tests on each word.

You should ignore the case of any letters.

**It is permissible to use the reverse keyword (instead of a regular expression) to accomplish the palindrome test.

You may have to read ahead to find out how to do some of the last few requirements.

The file which you will need for this exercise is Dictionary.txt . You should download this file and save it for use in future exercises.

Even though you will probably only use the file dictionary.txt to test your program, your program must be capable of accepting a file with any name that is specified as a command line parameter. This is merely an instance of the general rule that your program should never contain any hard coded values. Always build flexibility into your program. To download instead of displaying the Dictionary File, right click on the link and select "Save Target As".

For purpose of interpreting the following output, please pretend that each word shown is a real word.

Sample Output Run:

8 - abashed 
2 - abba 
5 - abba 
8 - abba 
7 - Abby 
7 - abet 
1 - aieioiuiia 
2 - aieioiuiia 
3 - aieioiuiia 
8 - aieioiuiia 
2 - azoosa
8 - azoosa 
8 - Croatian 
1 - Dalhousie 
5 - dad 
5 - deed 
3 - dissimilarities 
3 - institutionalizing 
6 - keenness 
6 - needlessness 
4 - nymphs 
4 - rkmpts
