Write a program that, given a word and a sequence of words , prints all the ways to obtain by concatenating some of the given words, without changing their relative order.
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 some of the given words, without changing their relative order. 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.
Input
hola 9 ho la h o l a hola la hol
Output
hola h+o+la h+o+l+a ho+la ho+l+a ho+la
Input
patata 5 tata ta pata tata pa
Output
-
Input
patata 5 pata pa ta tata tata
Output
pa+tata pa+tata pata+ta
Input
patata 2 pa ta
Output
-