Program 2

Program 2 - Counting Occurrences of Words

Due Date: Monday, October 1, 11:55pm

Write a program that will take input from a file and will output the number of times that each of the following five strings occurs in the input: There are no trap states or illegal characters.

1. reverse
2. enter
3. event
4. seven
5. tent

The input to your program must come from a file. The file should be a command line argument. The input does not have to be sensible English text. Our program will not be case sensitive (uppercase characters should be treated as their lowercase equivalents)

Sample from a program with pancake, peek, cake, keep:

PancakeepeekeEPancakpepepeek
kepepeekepeekancakee panpcakeepeekeepke

Occurrence counts: pancake count is 1 cake count is 3 keep count is 4 peek count is 5

Fourscoreandsevenpanpanpancakepanwwkwwp
keepeekpancakeepancakeePcakeep
keepancakecakEEPPEREPePE
keerpan_cake_panncakekekeepeekeepeekeepeeek
parka

Occurrence counts: pancake count is 4 cake count is 8 keep count is 9 peek count is 3

I will run your program by using the commandline to give a text file, so do not have your program ask for a file name. (see NewFSM.java example)