Concatenations (1)

Write a program that, given a word ww and a sequence of words s1,,sns_1, \dots, s_n, prints all the ways to obtain ww by concatenating some of the given words, without changing their relative order.

Input

Input consists of a word ww, followed by a natural number n>0n > 0, followed by s1,,sns_1, \dots, s_n. The words only include lowercase letters.

Output

Print all the ways to obtain ww by concatenating some of the given words, without changing their relative order. If there is no solution, print a hyphen. Follow the format of the samples.

Information about the checker

You can print the solutions to this exercise in any order.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:38:02.322Z

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