Subsets (2)

Write a program that, given a natural number mm and nn different words s1,,sns_1, \dots, s_n, prints all the subsets of mm elements that can be made up with the words.

Input

Input consists of two natural numbers mm and nn, followed by s1,,sns_1, \dots, s_n. Assume n>0n > 0 and 0mn0 \le m \le n.

Output

Print all the subsets of mm words that can be made up with s1,,sns_1, \dots, s_n.

Information about the checker

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

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:19:03.111Z

© Jutge.org, 2006–2026.
https://jutge.org