|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||40||12||11||36.667%|
There are many terms that people find offensive and nowadays it is easy to automate the process of eliminating these words, regardless of where they may occur. These offensive words are usually called four-letter words, chiefly because they are, but for this program we will look at any successive four letters, regardless of whether they are a word on their own or part of a larger word.
Of course, the exact terms that are deemed to be offensive depends on the listener — I am sure there are many of you who find the word ‘work’ at least disturbing, if not actually offensive. Thus the list of terms will be specified. Further, because these terms are so offensive, they cannot ever be specified explicitly, so they will in fact be referred to their first and last letters only.
For example, if the list of offensive words included ‘st’, ‘fk’, ‘dn’, and ‘ct’, then the sentence: ‘I cantered down to the shuttered shop to buy a fork.’ becomes‘I c**tered d**n to the s**ttered shop to buy a f**k.’
Input will consist of a ‘dictionary’, a list of no more than 20 words specified as pairs of lower case letters terminated by a line containing two # characters. This will be followed by a paragraph to be sanitised. Each line of the paragraph will contain no more than 60 characters. No word will straddle a line break. The paragraph will be terminated by a # on a line by itself.
Output will be the sanitised version of the given paragraph. Replace all sequences of four letters (no white space, punctuation marks or other characters) which are bounded by one of the pairs given in the dictionary, by ** in the central positions. All other characters, including formatting characters such as tabs and new line characters are to be left untouched. Words will be processed sequentially and overlapping sequences need not be considered.
st fk dn ct ## I cantered down to the Shuttered shop’s to buy a forK. #
I c**tered d**n to the Shuttered shop’s to buy a forK.