CS262, Fall 2011 Program assignment 2 (PA2) Instructor: Jyh-Ming Lien, jmlien@cs.gmu.edu Due date: section 005: Oct 21, 2011 (by midnight, 11:59pm) section 002: Oct 24, 2011 (by midnight, 11:59pm) Description: Goal: Practicing pointers and dynamic memory allocation. Given a list of forbidden words and an article. Find the sentence in the article that contains most forbidden words. Print the sentence with the characters in forbidden words replaced with X. If there are multiple sentence that have the same number of forbidden words, print all of them. Since there can be arbitrary number of forbidden words, and the length of each sentence can also be arbitrary long, you will need to use pointers and dynamic memory allocation. The first line of input contains a list of forbidden words, and the rest of the input text contains a sequence of sentences. Each sentence ends with a period "." and can be broken into multiple lines. ====================================== Input example: ABCD XYZ gmu Happy WoW Wow, this is the happiest day at GMU. I found this book called "abcd" that can be checked out from a GMU library. Output example: XXX, this is the happiest day at XXX. I found this book called "XXXX" that can be checked out from a XXX library. ====================================== Notice the punctuations and upper/lower cases of the characters in the above example. Since both sentences contain the same number of forbidden words, both censored sentences are printed. The input will be given from standard input. You will print the output to standard output. Follow the input/output requirements strictly to avoid any penalties. Note: If you use math.h, use -lm switch to tell gcc to link in the math library: EX: gcc pa2-002.c -lm To turn in: Submit a copy of your (well commented) source code and a sample terminal session showing several runs of your program. Show your example input clearly in your sample terminal session. You can use the example input above and create two more make-up examples. Your source code should have name "pa2-002.c" or "pa2-005.c" depending on your section and your terminal session should have name "pa2-002.txt" or "pa2-002.txt". Make sure that you code is well documented. Make sure that your documented code includes your name and the assignment number. Send your documents to cs262.2011fall.lien@gmail.com with subject line pa2-002-(Your G#) or pa2-005-(Your G#), again depending on your section.