1474 - Buzzwords
Time Limit : 2 Second
Memory Limit : 64 MB
Submission: 22
Solved: 4
- Description
- The word the is the most common three-letter word. It even shows up inside other words, such as "other" and "mathematics". Sometimes it hides, split between two words, such as "not here". Have you ever wondered what the most common words of lengths other than three are?
Your task is the following. You will be given a text. In this text, find the most common word of length one. If there are multiple such words, any one will do. Then count how many times this most common word appears in the text. If it appears more than once, output how many times it appears. Then repeat the process with words of length 2, 3, and so on, until you reach such a length that there is no longer any repeated word of that length in the text. - Input
- The input consists of a sequence of lines. The last line of input is empty and should not be processed. Each line of input other than the last contains at least one but no more than one thousand uppercase letters and spaces. The spaces are irrelevant and should be ignored.
- Output
- For each line of input, output a sequence of lines, giving the number of repetitions of words of length 1, 2, 3, and so on. When you reach a length such that there are no repeated words of that length, output one blank line, do not output anything further for that input line, and move on to the next line of input.
- sample input
-
OTHER MATHEMATICS NOT HERE AA Note that the last line of the sample input is a blank line.
- sample output
-
5 4 4 2 2 2 Note that the last line of the sample output is a blank line.
- hint
- source
- waterloo 2 October, 2010