Write a program that, given a word and a sequence of words , prints all the ways to obtain by concatenating all the given words exactly once.
Input consists of a word , followed by a natural number , followed by . The words only include lowercase letters.
Print all the ways to obtain by concatenating all the given words exactly once. If there is no solution, print a hyphen. Follow the format of the samples.
You can print the solutions to this exercise in any order.
Author: Unknown
Translator: Carlos Molina
Generation: 2026-01-25T11:14:44.748Z
© Jutge.org, 2006–2026.
https://jutge.org