Nucleic acid sequences are labeled over the alphabet {A,C,G,T}, and there are 4n possible genomic sequences of length n. Amino acid sequences, on the other hand, are labeled over the alphabet {A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y}, and there are 20n possible proteomic sequences of length n. An interesting problem is the generation of all the genomic sequences with n nucleotides or all the proteomic sequences with n amino acids, that is, the generation of all the words of length n over an alphabet Σ.
Write code for the words problem. The program must implement and use the WORDS 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.
Input
The input is an integer n and an alphabet Σ.
Output
The output is a sorted list of all the words of length n over the alphabet Σ.
Input
1 G T A C
Output
A C G T
Input
2 G T A C
Output
AA AC AG AT CA CC CG CT GA GC GG GT TA TC TG TT
Input
3 G T A C
Output
AAA AAC AAG AAT ACA ACC ACG ACT AGA AGC AGG AGT ATA ATC ATG ATT CAA CAC CAG CAT CCA CCC CCG CCT CGA CGC CGG CGT CTA CTC CTG CTT GAA GAC GAG GAT GCA GCC GCG GCT GGA GGC GGG GGT GTA GTC GTG GTT TAA TAC TAG TAT TCA TCC TCG TCT TGA TGC TGG TGT TTA TTC TTG TTT