Consonants and vowels

Write a program that reads n consonants and n vowels, and prints all the
words that can be made up by using each letter exactly once. The words
must begin with a consonant, and alternate consonants and vowels. In
this exercise, we will assume that ‘y’ is a vowel.

Input

Input consists of a natural number n between 1 and 6, followed by n
different consonants and n different vowels. Both consonants and vowels
are given in alphabetical order.

Output

Print the words that can be made up with the 2n given letters, starting
with a consonant and always alternating consonants and vowels. Print the
words in alphabetical order, one per line.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:30:27.446Z

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