CHALLENGES

Back to home page
  • String Permutations

    Sponsoring Company:

    Challenge Description:

    Write a program to print out all the permutations of a string in alphabetical order. We consider that digits < upper case letters < lower case letters. The sorting should be performed in ascending order.

    Input sample:

    Your program should accept as its first argument a path to a file containing an input string, one per line. E.g.

    hat
    abc
    Zu6

    Output sample:

    Print to stdout, permutations of the string, comma separated, in alphabetical order. E.g.

    aht,ath,hat,hta,tah,tha
    abc,acb,bac,bca,cab,cba
    6Zu,6uZ,Z6u,Zu6,u6Z,uZ6