Subsets (1) P18957


Statement
 

pdf   zip

thehtml

Write a program that, given n different words s1, …, sn, prints all the subsets that can be made up with the words.

Input

Input consists of a number n > 0, followed by s1, …, sn.

Output

Print all the subsets that can be made up with s1, …, sn.

Information about the checker

You can print in any order both the solutions and the elements inside each solution.

Public test cases
  • Input

    3
    hola adeu hi
    

    Output

    {}
    {hi}
    {adeu}
    {adeu,hi}
    {hola}
    {hola,hi}
    {hola,adeu}
    {hola,adeu,hi}
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Python Python
    User solutions
    C++ Haskell PHP Python