A composite word is a concatenation of two-or-more other words, such that the minimum length of each constituent word is 3. Write a program which accepts a list of words and an integer M as input and prints the count of composite words which can be constructed by concatenating M or more other words which are also present in the input.
The word-list file used in the examples is available here: sample.txt
| 1) |
Input:
sample.txt 2
Output:
106
|
| 2) |
Input:
sample.txt 3
Output:
3
|
| 3) |
Input:
sample.txt 4
Output:
0
|