Getting wrong-answer

Sir/Mam
I am getting wrong-answer on submitting code but it gives correct output for given sample input.
Also what should be done in case query string is not found in dictionary. Kindly help.

It’s already specified in the question. If there’s no string as an answer, just add it to your dictionary. The best possible data structure to this purpose would be Trie according to me.

Sir In the last line of output format it is written to print No suggestions.

This is the link of code: https://ide.codingblocks.com/s/163253

Your code doesn’t work correctly when the word isn’t found in the dictionary. I tried it for a test case and it gives wrong answer for such cases. Check that part of code.

Sir if you could pls share the test-case here along with desired output

Add the same strings as in the sample case and query for strings “Zack” and “Za”. You should get “No Sugg” and “Zack”.

Done sir. But it needs more rectification if you could help with that. https://ide.codingblocks.com/s/163689

This works fine according to me now. What error does it show?

Sir code is not being accepted and displays wrong-answer in all three test cases.

What is this sum that you are finding in the main function. What is the use of it?

That is mentioned in the constraint section which says that sum of length of strings should be less than 2*10^5

That is just a constraint. You don’t have to place constraint in the program itself. They are just for analysing complexity of code

Even after commenting those part yields wrong answer on submitting.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.