题解 | #DNA序列#

DNA序列

https://www.nowcoder.com/practice/e8480ed7501640709354db1cc4ffd42a

while True:
    try:
        s = input()
        n = int(input())
        dic = {}
        for i in range(len(s)-n+1):
            zi = s[i:i+n]
            
            a = zi.count('G') + zi.count('C')
            dic[zi] = a
        ls1 = []
        for i, j in dic.items():
            ls1.append(j)
        b = max(ls1)
        for i, j in dic.items():
            if j == b:
                print(i)
                break
    except:
        break

全部评论

相关推荐

2025-12-10 19:36
湖北工业大学 Web前端
饿魔:看到在线简历了吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务