题解 | #DNA序列#
DNA序列
https://www.nowcoder.com/practice/e8480ed7501640709354db1cc4ffd42a
s = input() n = int(input()) r = 0 res = '' for i in range(len(s)-n+1): ratio = (s[i:i+n].count('C') + s[i:i+n].count('G'))/n if ratio > r: r = ratio res = s[i:i+n] print(res) # sliding window
滑动窗口