Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Naming Convention

By akash.kuet · Limits 1s, 512 MB

Tony works in a multinational technology company named Voogle LLC. The employees of Voogle follow certain rules to name a function. They have a list of unique function names and each name contains lowercase letters. But they will choose names which consisted entirely of at least two names from the list. Suppose if the list contains function names such as "sum", "add", "addsum", they will choose "addsum" name because it is made of concatenation of "add" and "sum".

So you are given a list of words. You have to find out words which are made of concatenation of at least two words from the list. Print the words so that their relative order is maintained from the input list. If no words are found, then print “No solution”.


Input starts with an integer N, the number of names the list contains. In the next line there are N words, each character of the word contain lowercase letters.


1≤Each string length≤100


Output list of words which follows Voogle’s function naming convention or “No solution”.


a ab ac aa acab
aa acab

aa contains a twice and acab contains ac and ab.



43% Solution Ratio

code_hard123Earliest, Mar '20

NaimulFastest, 0.0s

mahdi.hasnatLightest, 131 kB

probableShortest, 601B


Login to submit


You are given a list of strings and you have to find out which strings can be made of concatenating ...

Related Contests

Toph uses cookies. By continuing you agree to our Cookie Policy.