Skip to content

wxiaomou/longest-concatenated-word

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Write a program that reads a file containing a sorted list of words (one

word per line, no spaces, all lower case), then identifies the longest

word in the file that can be constructed by concatenating copies of

shorter words also found in the file.

 

For example, if the file contained:

 

       cat

       cats

       catsdogcats

       catxdogcatsrat

       dog

       dogcatsdog

       hippopotamuses

       rat

       ratcatdogcat

 

The answer would be 'ratcatdogcat' - at 12 letters, it is the longest

word made up of other words in the list.  The program should then

go on to report how many of the words in the list can be constructed

of other words in the list.
To run the code in eclipse, the memory allocation for the virtual machine should be increased.A safe value would be 
around 512 MB. 

About

find the longest concatenated word from a file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published