题解 | 穷哈哈~

穷哈哈~

https://www.nowcoder.com/practice/5b3184b233f34fb39a7f259ae82eb42c

n = int(input())
s = input()
max = 0
c = 0
q = None
for i in s:
    if i != 'a' and i != 'h':
        q = None
        continue
    if q is None:
        c = 1
        q = i
    else:
        if i != q:
            c = c + 1
            q = i
        else:
            c = 1
            q = i
    if c > max:
        max = c
print(max)
        
    

全部评论

相关推荐

点赞 评论 收藏
分享
2025-12-30 16:42
同济大学 C++
仁狂躁使者:哎呀,不用担心,我当时配环境配了两天,项目捋不清就问问导师能不能用ai,慢慢就清了,会好起来的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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