LearnPy Hub
← Modules & the Standard Library problems
Medium

Choose Teams

Read a line of names and k. Print every group of k names (itertools.combinations) in input order, one group per line.

Input

A line of names, then k.

Output

One group per line.

Sample 1

Input
A B C D
2
Output
A B
A C
A D
B C
B D
C D

Sample 2

Input
Mim Rafi Sara
3
Output
Mim Rafi Sara
solution.py
Output appears here
Choose Teams · Python practice problem · LearnPy Hub