Set of sets P54824


Statement
 

pdf   zip

thehtml

Write a program that, given a sequence of sets of integer numbers, prints the sets in order and with no repetitions.

Input

Input is a sequence of non empty sets of integer numbers, a set per line. The elements inside each set are different, and can be given in any order.

Output

Print the sets of the input, one per line, in order and with no repetitions. Print the sets sorted non-decreasingly by the number of elements. If there is a tie, print before the lexicographically smallest set. The elements of each set must be written in increasing order.

Hint

The standard comparation between two sets follows the lexicographical order.

Public test cases
  • Input

    1 2 3 4 5 6
    6 4 2
    9 5 4 0 2 1
    0 1 2 5 6 7
    9
    8 7
    4 2 6
    7 8
    

    Output

    9
    7 8
    2 4 6
    0 1 2 4 5 9
    0 1 2 5 6 7
    1 2 3 4 5 6
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++ Python