Digital Dictionary - Wrong answers

Apart from tries, I have used a different approach. The given test case is showing correct output but after submitting all the test cases are showing wrong answers. Please go through it and tell me the errors.

for the test case:

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

the correct output should be

app
apple
application
batman
batmobile
No suggestions
batcave
batman
batmobile
cat
apple
application
No suggestions

your code omits batcave.
debug for this

I have updated the code, still, all the test cases except one are not running.

for i/p:

10
sher
sherlock
sherlocked
tardis
tardisblue
luck
lucifer
samdean
castiel
cassifer
8
lu
s
chuck
c
cas
sherl
tardisissexy
tard

o/ should be

lucifer
luck
samdean
sher
sherlock
sherlocked
No suggestions
cassifer
castiel
chuck
cassifer
castiel
sherlock
sherlocked
No suggestions
tardis
tardisblue
tardisissexy

I am getting correct output for 2 cases now. I have forgot to put the sorting statement before the for loop. Please check where it is going wrong. https://ide.codingblocks.com/s/429273

In this problem you need to create a Trie data structure of all the words that are in the dictionary. Now, in queres, we need to just check the words which have the prefix same as given in input. And than we need to use DFS for getting all the possibilities of words. Thus the max words visited will be all the words in dictionary.
see this: