FARMAAN_KHANN's blog

By FARMAAN_KHANN, history, 13 months ago, In English

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

  • Vote: I like it
  • -43
  • Vote: I do not like it

| Write comment?