Sample Output doubt

Lexicographic means alphabetical order. But last 2 outputs are not in alphabetical order. Please explain

hello @vatsal50

u cannot change the order of characters ie the relative ordering must remain same as given in input. u r allowed only to remove some characters from the string .

bbbacdbbb

here remove all b from starting and last 2 bs u will get ->
acdb

is bacd a valid ans?

no it is not lexocographically smallest.

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.