Your task is to write a program that reads a sequence of words and prints, for each word, all the other words of the sequence contained in it.
Your program has to implement and use the function
bool contains(string s1, string s2);
that returns if the word |s1| contains the word |s2| under the precondition that the length of |s1| is greater or equal than the length of |s2|.
For instance, |contains ("enlightenment", "light")|, |contains
("enlightenment", "enlightenment")|, |contains ("enlightenment",
"lighten")| and
|contains ("enlightenment", "ten")| have to return |true|, but, however,
|contains ("enlightenment", "ei")|
and |contains ("enlightenment", "might")| have to return |false|.
Input consists in a natural number followed by different words .
The program has to print a line for each in this order. Each line starts with , followed by the symbol “:” and the list of all the input words contained in , in the same order than the input. Notice that the list corresponding to each always includes , since every word contains itself.
Input
9 lighten in o en building light build enlightenment world
Output
lighten: lighten en light in: in o: o en: en building: in building build light: light build: build enlightenment: lighten en light enlightenment world: o world