Digital Dictionary test case not passing

My sample test cases are passing , I cannot understand where my code is getting wrong
My code link:

Can anyone please review my code?

Sorry, for answering this late.
I’ll resolve your doubt today.:sweat_smile:

I am attaching sample input and output for this problem.
Run your program for those inputs and resolve the problem that is producing wrong outputs.

https://drive.google.com/open?id=1RWnyrLfDFce3Qi_9THQYCN_PvL-AhuUm

Hope this would help.

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.

it did not help please check my code

Okay, then I’ll tell you your mistakes.

yes please it will help me a lot

You need to ignore the cases:

For eg, Pe and pe both are prefix to peter.
But, your program is failing to do so.

Hope, this would help.

Now, your code will pass all the test cases and i guarantee you this.

I have found the fault.
I know, it’s not mentioned in the problem.
But you have to update the dictionary i.e. insert the string that is not present in the dictionary.

just add a statement to insert the unmatched string in your code as shown below:

	else
	{
		cout<<"No suggestions"<<endl;
                     insert(s);
		return;
	}

Give a like, if you are satisfied.

1 Like