Problem B
Engineering English
Engineers have taken over the university’s English department! As part of their plan to dominate the university, they have employed you to write their nefarious software. Their goal is to eliminate all duplicated words from all texts in the English department, because, as they say, “duplicated words are duplicated work” and “duplicated work wastes money.” Actually, what they would really say is “duplicated words are . work” and “. . wastes money”. This is what your program should do – remove all duplicate words and replace them with a period.
Input
Input is a textbook with at most
Output
Print each word the first time it appears, but thereafter if that word appears again print a period.
Sample Input 1 | Sample Output 1 |
---|---|
Engineering will save the world from inefficiency Inefficiency is a blight on the world and its humanity |
Engineering will save the world from inefficiency . is a blight on . . and its humanity |
Sample Input 2 | Sample Output 2 |
---|---|
he said that that that that that man used was wrong |
he said that . . . . man used was wrong |