My code is only passing 2 test cases , doing dry run givins the correct output,
my code:- https://ide.codingblocks.com/s/270437
My code is only passing 2 test cases , doing dry run givins the correct output,
my code:- https://ide.codingblocks.com/s/270437
I thing is you missed case when ans doesn’t exist. You have to to print “No String” In that case. So change line 58 to if(ans.length()==0){ cout<<“No String”<<endl; }
else { cout << ans; }
Dry run your code on this testcase
aaaab
ab
output should be “ab” but your code is giving “aaab”