Digital Dictionary

what’s wrong in this code? all cases fail : https://ide.codingblocks.com/s/230296

@YashJ,

Test case:
6
app
apple
application
batman
batmobile
cat
7
ap
bat
batcave
bat
cat
appl
appledore

Correct Output:
app
apple
application
batman
batmobile
No suggestions
batcave
batman
batmobile
cat
apple
application
No suggestions

As mentioned in the questions And if no such words are available for a given search word, add this word to your dictionary. you need to add the word which is not in the dictionary to your dictionary.

In the above example that would be ‘batcave’

ok I corrected my code here: https://ide.codingblocks.com/s/232442

still only 2 cases passed

@YashJ,

https://ide.codingblocks.com/s/232828 corrected code. I modified your search method.

thank you but can you tell me what I am doing wrong in my code?

@YashJ,

In the search method pass 2 more arguments. One for prefix of the word and another for the original word. In case it’s not present add it to the dictionary