Words with x, y and z

In this problem we will consider words of size n, made from letters ‘x’,
‘y’ and ‘z’, and without more than c equal consecutive letters. Write a
program that writes all words that satisfy these constraints.

Input

Input consists of several cases, each with an n between 1 and 15 and a c
between 1 and n.

Output

For each case, write in alphabetical order all words of length n made
from letters ‘x’, ‘y’ and ‘z’ that do not contain c + 1 equal
consecutive letters. Write a line with 20 hyphens at the end of each
case.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T14:17:46.821Z

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