Consonants and vowels

Your task is to write a program that reads n consonants and n vowels,
and that prints all the words that can be formed using exactly once each
one of the given letters. The words have to start in consonant, and must
alternate consonants and vowels.

Input

The input consists of a natural n between 1 and 5, followed by n
different consonants and n different vowels. The consonants as well as
the vowels are given in alphabetical order.

Output

Your program must print all the words that can be formed with the 2n
given letters, starting in consonant and alternating consonants and
vowels. The words must be written in alphabetical order, one per line.
Logically, it is not necessary that the generated words have any
meaning.

Author: Salvador Roura

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T12:01:10.501Z

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