SP18201 RKS - RK Sorting
Description
**RK** is a great code breaker. He knows any cipher in the world can be broken by frequency analysis. He intercepted an enemy message. The message consists of **N** numbers, smaller than or equal to **C**. RK belives freqency analysis consists of sorting this sequence so that more frequent numbers appear before less frequent ones.
Formally, the sequence must be sorted so that given any two numbers X and Y , X appears before Y if the number of times X appears in the original sequence is larger than the number of time Y does. If the number of appearances is equal, the number whoes value appears sooner in the input should appear sooner in the sorted sequence.
Help RK by creating a "frequency sorter".
Input Format
First line of input contains two integers, N (1
Output Format
First and only line of output should contain N numbers, the sorted sequence.