lundi 30 mai 2016

Shuffle elements in a string and get all the possible arrangements

This is what I want to do, when given a list, I want to shuffle the elements in the list and get all the possible combinations of elements in that list. E.g. given a list as shown below,

    Ben went to the shop

so listing and printing all the possible combinations,

    shop went to the Ben
    went to the Ben shop
    to the went shop Ben
            .
            . 
            .

How do I get all the possible combinations and print them out one string at a time?




Aucun commentaire:

Enregistrer un commentaire