Problem

4 /9


Sorting a dictionary

Problem

An alphabetic-frequency dictionary is a frequency dictionary in which words with their frequency (occurrence) are arranged alphabetically.
Build a dictionary sorted by word frequency, in which words are arranged in descending order of their frequency of occurrence, to the right of each word should be indicated how many times it occurs in the text. If the number of words is the same, the sort is word by word in lexicographic order.  The sign of the end of the text is "END!". 

Input
Lines of text are given as input. The last line contains one single word "END!" and is a sign of the end of the text.

Imprint
Display all the words on the screen, indicating, separated by a space, how many times this word occurs in the text. Each word on a separate line.

 
Examples
# Input Output
1 one two
three one
two
END!
two 2
one 2
three 1