Under construction

Still being built. Things may change

Zipf's Law

Time limit1sMemory limit128 MB

Summary
For each test case, count the words in a book body and print the words that appear exactly n times, in lowercase alphabetical order.
Level

Easy3 of 10

Topics
Hash map, String, Sorting, Implementation
Solved
No attempts yet

Problem

The Harvard linguist George Kingsley Zipf (1902–1950) discovered that, in a given book, the frequency of the kk-th most common word is proportional to 1/k1/k.

Given the body of an English book, write a program that finds every word that appears exactly nn times. A word is a maximal sequence of letters, and words are separated by non-letter characters. Matching is case-insensitive, and every word in the text is a valid English word.

Input

The input consists of several test cases. The first line of each test case contains an integer nn. Everything from the next line up to (but not including) the line that reads EndOfText is the body of the book. The body contains at most 10000 words. EndOfText is only a marker that separates test cases and never appears within the body.

Output

For each test case, print every word that appears exactly nn times, in alphabetical order, one per line, in lowercase. If there is no such word, print There is no such word.

Print one blank line between consecutive test cases.

Examples4

  1. Example 1

    Input
    2
    
    In practice, the difference between theory and practice is always
    greater than the difference between theory and practice in theory.
    	- Anonymous
    
    Man will occasionally stumble over the truth, but most of the
    time he will pick himself up and continue on.
            - W. S. L. Churchill
    EndOfText
    1
    the the it it ate ate the Bean bean
    EndOfText
    
    Expected output
    between
    difference
    in
    will
    
    There is no such word.
    
  2. Example 2

    Input
    1
    hello world
    EndOfText
    
    Expected output
    hello
    world
    
  3. Example 3

    Input
    5
    a a b
    EndOfText
    
    Expected output
    There is no such word.
    
  4. Example 4

    Input
    2
    Cat cat, DOG dog! bird
    EndOfText
    
    Expected output
    cat
    dog