Some genome rearrangements change the order of the nucleotides in a nucleic acid sequence, resulting in a permutation of the nucleic acid sequence. For example, TATATA is a frequent rearrangement of TATAAT. An interesting problem is the generation of all the permutations of a genomic sequence of length .
Write code for the permutations problem. The program must implement and use the PERMUTATIONS function in the pseudocode discussed in class, which is recursive and is not allowed to perform input/output operations. Make one submission with Python code and another submission with C++ code.
The input is a string over the alphabet .
The output is a sorted list of all the permutations of , without repetitions.
There are at most permutations of a genomic sequence of length .
Input
ACGT
Output
ACGT ACTG AGCT AGTC ATCG ATGC CAGT CATG CGAT CGTA CTAG CTGA GACT GATC GCAT GCTA GTAC GTCA TACG TAGC TCAG TCGA TGAC TGCA
Input
TATAAT
Output
AAATTT AATATT AATTAT AATTTA ATAATT ATATAT ATATTA ATTAAT ATTATA ATTTAA TAAATT TAATAT TAATTA TATAAT TATATA TATTAA TTAAAT TTAATA TTATAA TTTAAA