Woburn Challenge 2016-17 Round 1 - Junior Division
Problem 2: Frankenstein's Monster
Frank is upset. "Frankenstein is so big and scary, Frankenstein this, Frankenstein that", he thinks to himself. "Doesn't anyone know that Frankenstein is the name of the scientist, and who they're actually referring to is Frankenstein's monster!?".
He's determined to remedy the situation once and for all. How? It's quite simple. Since everyone derives their knowledge entirely from the internet, Frank will just have to find every occurrence of the word "Frankenstein" on every website, and replace it with "Frankenstein's monster". Problem solved!
For starters, Frank is tackling a Universal Pictures monster fanfiction site. He's downloaded the raw text of one particular story, a string with at most 1000 characters. For convenience, every space has been replaced with a period. As such, the string contains no whitespace, and consists of only lower/uppercase letters, digits, and common punctuation.
A "word" is a maximal consecutive sequence of non-period characters in the string. That is, each word is either preceded by a period or is at the start of the string. Similarly, each word is followed by a period or is at the end of the string. Frank wants to replace each instance of the word "Frankenstein" with the two words "Frankenstein's" "monster" (separated by a period). Frank distinguishes uppercase and lowercase letters, so he doesn't want to replace the word "frankenstein", for example.
The first and only line of input consists of a single string representing the content of the story.
Output a single line consisting of a single string representing the "corrected" story.
Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 16, 2016
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3