Dictionary_order_larger


sir,my code doesn’t passing the 2nd test case but when i print the answer in reverse order 2nd test case passed but another two failed.please suggest me the changes.

Hello @rajukumarbhui,

  1. Make inp a string type variable.
    Reason:
    When you make changes to a character array passed as parameter in the function, it also persists in the char array in the main function.
    By, using string you can prevent these changes in the inp in the main function.

  2. There is no need to swap back.
    Reason: Not required by the question

  3. There is no need to sort string.
    Reason: Though it is dictionary order, but it won’t match with the order given in the question.
    To understand this batter, see the last two string of the sample output.

I have modified your code:

Hope, this would help.
Give a like, if you are satisfied.