Learn to Write

Time Limit: 1 Second    Memory Limit: 32768 KB

A WOLF who had a bone stuck in his throat hired a Crane for a large sum to put her head into his mouth and draw out the bone When the Crane had extracted the bone and demanded the romised payment the Wolf grinning and grinding his teeth exclaimed Why you have surely already had a sufficient recompense in having been permitted to draw out your head in safety from the mouth and jaws of a wolf
In serving the wicked expect no reward and be thankful if you escape injury for your pains

Have you ever read paragraphs like this? there is no comma no full stop. what does it mean? could'n you bear it? alright then, write a program by yourself to add punctuations in a paragraph to overcome this annoying thing.

Input

There are two parts in the input.

The first part of the input contains a dictionary of up to 8000 sentences or phrases followed by a blank line. Each sentence or phrase occupis one line and will not exceed 200 characters. There is no other punctuations in each sentence or phrase except the last character.

Then, there will be an essay in the second part of the input. The elegant essay consists of at most 200 paragraphs. Each paragrah in the essay will have at most 10 lines and two spaces as the begining. Each line of the paragraph will contains no more than 200 characters. No word will be separeted in two lines. The essay will be terminated by a blank line.

All the words in the input will not exceed 15 characters.

Output

For each paragraph, your job is to divide it into several sentences or phrases according to the dictionary by using the least punctuations. If there is no such division, out put the original paragraph. If there are several ones, out put the one with the longest last sentence. If there are still several ones, than output the one with the longest last one but two, etc. You should also leave a blank line in the end of the modified essay.

Note: you should not change the format of the paragraphs. The only job you have to do is to add punctuations.

Sample Input

you,
Wolf?
Why,
the Wolf,
exclaimed:
no reward,
for a large sum,
A WOLF who had a bone,
In serving the wicked,
jaws of a wolf.
A WOLF who had a bone stuck in his throat hired a Crane,
to put her head into his mouth and draw out the bone.
When the Crane had extracted the bone and demanded the romised payment,
grinning and grinding his teeth,
you have surely already had a sufficient recompense,
in having been permitted to draw out your head in safety from the mouth and 
jaws of a wolf.
stuck in his throat hired a Crane.
to put her head into his mouth and draw out the,
bone When the Crane had extracted the bone and demanded the romised payment 
the,
have surely already had a sufficient recompense.
In serving the wicked expect,
expect no reward,
and be thankful if you escape injury for your pains.

A WOLF who had a bone stuck in his throat hired a Crane for a 
large sum to put her head
into his mouth and draw out the bone When the Crane had extracted the bone and 
demanded the
romised payment the Wolf grinning and grinding his teeth exclaimed Why you have 
surely
already had a sufficient recompense in having been permitted to draw out your 
head in safety
from the mouth and jaws of a wolf
In serving the wicked expect no reward and be thankful if you escape injury 
for your pains

Sample Output

A WOLF who had a bone stuck in his throat hired a Crane, for a 
large sum, to put her head
into his mouth and draw out the bone. When the Crane had extracted the bone 
and demanded the
romised payment, the Wolf, grinning and grinding his teeth, exclaimed: Why, 
you have surely
already had a sufficient recompense, in having been permitted to draw out your 
head in safety
from the mouth and jaws of a wolf.
  In serving the wicked, expect no reward, and be thankful if you escape injury 
for your pains.




	

Submit

Source: ZOJ Monthly, March 2004