Implement a program that reads the contents of a file such as the dracula.txt file attached at the bottom of the page and builds a HashMap of ArrayLists that stores a mapping from each word in the document to a list of the locations where the word occurs. The requirements of the program are as follows:
The user will enter the name of the file to be processed.
Your program will process the file and generate the HashMap of ArrayList objects. For example, if your document contained the following text "The cat and the dog ran." your HashMap would have 5 key, value pairs where the keys would be as follows: {the, cat, and, dog, ran}. The value for 'the' would be an ArrayList containing the integers 1 and 4 since the word 'the' appears at positions 1 and 4 in the document. The value for 'cat' would be an ArrayList containing the integer 2, and so on.
Once the data structure has been built, allow the user to repeatedly (in a loop) enter search words. For each word entered, print a list of the locations where the word occurs and then prompt for the next word.
Hint: you can remove punctuation characters by calling the following method on a string and saving the result: replaceAll("\\W", "") In this example, \\W is a regular expression specifying any non-word charcater. Any non-word character is replaced with nothing. You can also use the String toLowerCase method to convert the entire word to lower case.
Submission
Please submit your work in an SVN directory https://www.cs.usfca.edu/svn/<username>/cs112/lab4.