WORD COMPOSITION PROBLEM

Revision en2, by FARMAAN_KHANN, 2023-10-13 15:16:29

write a program that:

  1. reads provided inputs containing alphabetically sorted words list (one word per line, no spaces, all lower case)
  2. output the following things
 2.1  longest compounded word

2.2 second longest compounded word

NOTE :: a compounded word is one that can be constructed by combining (concatenating) shorter words also found in the same test-case input file :: small word list, consisting following words

cat 
 cats
 catsdogcats
 catxdogcatsrat
 dog
 dogcatsdog
 hippopotamuses
 rat 
 ratcatdogcat

ANSWERS:: longest compounded word :: ratcatdogcat second longest compounded word :: catsdogcats constraint 1<=N<=10^8

please provide me the solutions and time complexity with explanation i hope all off you reply this question comes in GOOGLE in open book assignment conducted in IIT mandi love you all

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English FARMAAN_KHANN 2023-10-13 15:16:29 42
en1 English FARMAAN_KHANN 2023-10-13 14:31:02 889 Initial revision (published)