• 1
    Input and Output Data
    • Tasks
  • 2
    Conditions
    • Tasks
  • 3
    For Loop
    • Tasks
  • 4
    Strings
    • Tasks
  • 5
    While Loop
    • Tasks
  • 6
    Lists
    • Tasks
  • 7
    Two-Dimensional Arrays
    • Tasks
  • 8
    Dictionaries
    • Tasks
  • 9
    Sets
    • Tasks
  • 10
    Functions and Recursion
    • Tasks
  • к

Занятие 9. Sets

Difficulty level:

Task«Massive»

Imagine that you will organize a party and want to make all possible lists of guests in order to take into account different interests and companies. You have a common list of potential guests. Your task is to write a program that, according to a given list of guests, forms all possible messages (groups of guests) for the party. An empty list is also an acceptable option (no one has come). It is important that the order of the guests in the subscriptions corresponds to the order on the source list, and the computers themselves are displayed in a lexicographic order.

Input format

a line is supplied to the input, which is a list of guests separated by commas. For example: "Anya, Boris, Vika"

Output format

The program should deduce all possible calculations (guests groups), each on a separate line. The names in the computations should be separated by commas and sorted by alphabet. An empty list should be presented as an empty line. The procedure for the output of the calculations should be lexicographic

Example

Input

Anya, Boris, Vika

Output

Anya
Anya, Boris
Anya, Vika
Anya, Boris, Vika
Boris
Boris, Vika
Vika

Hint

There will be no clue here, decide for yourself!

main.py
Test 1
Test 2
Test 3
Test 4
Test 5
Test 6
Test 7
Test 8
Test 9
Test 10
Developer’s solution

🎉 Congratulations! 🎉

You did an excellent job with the task! It was a challenging problem, but you found the correct solution. You are one step closer to mastering programming! Keep up the good work, because every stage you pass makes you even stronger.

AD

Advertisement

red-snake blue-snake green-snake

Running your code...

Помощник ИИ

Привет! Я твой помощник по программированию. Задавай любые вопросы по Python, я могу рассказать о функциях, методах, обьяснить то, что тебе не понятно, а так же о текущей задаче!