Code is failing on other case

bhaiyaa given code works alright for the sample base case but the compiler is not acceptable for other cases.

hi @94217846kunal
ur logic is correct,
but according to ques ans should be lexicographically sorted order… so instead of directly printing just store them in a vector, then sort and print…
corrected code -->

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.

bhaiyaa is code mai ek diikat hai bhale he ye accept hojara but ye same ans multiple tyme print kar ra in the case of some example e.g ccb isme bcc bcc do barr print hora how to cater this case

hi @94217846kunal
ques is not asking to print only once… if multiple occurances occur print all of them…
Else it u just want to print single occurance u can store ur ans in a set and not vector, bcoz in set u can store only one occurance of each string…

1 Like

okay bhaiyaa clear ho gya

bhayii vector ki jagah set us ekia to kafi error ara hai

hi @94217846kunal
Kindly send code in which u have used set… i will check ur code…

bhaiyaa ye raha https://ide.codingblocks.com/s/644795

hi @94217846kunal
in that case first push all elements from set to vector, then sort the vector and print ans…
refer this–>


but in this ques it is not asked to print only one occurrence, so don’t use set…
hope its clears ur doubt…

Bhaiya vector mai store karne ki zarooorat kyu padi hum direct he set ko bhi to print kar sakte hai na

Yes yes Kunal… we can do it directly only since set already sorts them…

1 Like

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.