# Problem
# Assume that an alphabet has a predetermined order; that is, we write the alphabet as a permutation =(a1,a2,…,ak), where a1 # Given two strings s and t having the same length n, we say that s precedes t in the lexicographic order (and write s # Given: A collection of at most 10 symbols defining an ordered alphabet, and a positive integer n (n≤10). # Return: All strings of length n that can be formed from the alphabet, ordered lexicographically (use the standard order of symbols in the English alphabet). # Sample Dataset # A C G T # 2 # Sample Output # AA # AC # AG # AT # CA # CC # CG # CT # GA # GC # GG # GT # TA # TC # TG # TT # 列出长度为2的组合 import itertools n =2 # 长度为2 seq = ['A', 'C', 'G', 'T']# 基因序列包含的字符 # 使用itertools生成所有可能的组合 result = itertools.product(seq, repeat=n) # 打印所有组合 for iin result: print(''.join(i))