Recursion Dictionary Order (Larger)

how to sort this output string lexographically and print the largest element.

  1. first check the condition whether input>in
    then only insert it into set

  2. also print string in new line

Modified code