Words with x, y and z

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

Input

Input consists of several cases, each with an nn between 1 and 15 and a cc between 1 and nn.

Output

For each case, write in alphabetical order all words of length nn made from letters ‘x’, ‘y’ and ‘z’ that do not contain c+1c+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