题解 | #密码验证合格程序#

密码验证合格程序

https://www.nowcoder.com/practice/184edec193864f0985ad2684fbc86841

while True:
    try:
        s=input()
        ss=list(s)
        n=len(s)
        c=[0 for i in range(4)]#upper,lower,digit,other
        for i in s:
            if i.isupper():
                c[0]+=1
            elif i.islower():
                c[1]+=1
            elif i.isdigit():
                c[2]+=1
            else:
                c[3]+=1
        res=''
        for i in range(n):
            for j in range(i+1,n):
                if s[i:j+1] in s[j+1:n] and j+1-i>len(res):
                    res=s[i:j+1]
        if n>8 and c.count(0)<2 and len(res)<3:
            print('OK')
        else:
            print('NG')
    except:
        break

居然一遍过的,我也比较诧异

全部评论

相关推荐

认真搞学习:这么良心的老板真少见
点赞 评论 收藏
分享
Lorn的意义:1.你这根本就不会写简历呀,了解太少了 2.你这些项目经历感觉真的没啥亮点啊,描述的不行,重写书写一下让人看到核心,就继续海投 注意七八月份ofer还是比较多的,越往后机会越少,抓住时机,抓紧检查疏漏,加油查看图片
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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