题解 | #DNA序列#
DNA序列
https://www.nowcoder.com/practice/e8480ed7501640709354db1cc4ffd42a
dna = input() length = int(input()) if length >= len(dna): print(dna) else: sub_strs = [] for index in range(len(dna)-length): sub_strs.append(dna[index:index+length]) GC_ratio = [] for sub_str in sub_strs: GC_ratio.append((sub_str.count("C") + sub_str.count("G"))/length) highest_GC_ratio_index = GC_ratio.index(max(GC_ratio)) print(sub_strs[highest_GC_ratio_index])