Code is passing all sample TC but not getting submitted .plz help

hello @bhogadi.sreeja19

sort ur input string

yes when we sort the input string the code is submitted,but why is that. in sample tc without sort the code was still printing the correct output

is sample input sorted?

no earlier it wasnt ,but why do we need to sort …

check output format -> they are saying to print output in lexicographical order.
and so to generate string in lexicogrpahical order we need to sort our input

ok understood,thankyou !!