• 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
  • к

Lesson 9. Sets

Difficulty level:

Task«"Bookworm"»

💻 Python
You work an analyst in the Bookworm online store, which sells books of various genres. The marketing department wants to find out which books of books most often buy together to form promotional proposals and recommendations. You have data on user purchases for the last month. Each purchase is a set of genres of books purchased by one user. Your task is to determine the most popular sets of genres that are found in purchases quite often.

Input format

The first line is introduced by the number of n & nbsp; (1 & le; n & le; 100), representing the total number purchases.
rn
in each of the n lines enters information about one purchase. Each line is a set of genres separated by spaces. Genres are lines consisting of Latin letters (A-Z, A-Z)

Output format

Bring all the sets of genres that are found at least in & nbsp; s & nbsp; purchases, purchases, Where & nbsp; s is introduced after all the purchases. Each set of genres should be sorted in a lexicographic order (by increasing) and bred on a separate line. Kits should be displayed in lexicographic order

Example

Input

5
Comedy Drama
Comedy Fiction
Drama Comedy
Fiction
Comedy Drama
2

Output

Fantasy Sci-Fi
mystery
sci-fi

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...

AI Helper

Hi! I am your programming assistant. Ask me anything about Python — I can explain functions, methods, and help you understand the current task!