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
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
Input consists in a natural number n followed by n different words p1,…,pn.
Output
The program has to print a line for each p1,…,pn in this order. Each line starts with pi, followed by the symbol “:” and the list of all the input words contained in pi, in the same order than the input. Notice that the list corresponding to each pi always includes pi, 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